Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Intro to Arrays with comments
//gcc 5.4.0 #include <stdio.h> void main(void) { int sum = 0; int n = 10; int scores[10]={9,20,30,40,51,60,70,80,90,100}; //initializes the array and enters in the values// for (int i=0; i<n; i++){ //classic "for" loop statement that uses i as the counter and every time the i counts a value in the arraty// if (scores[i]%2==0){ //if statement checks if certain "i" element of array is divisable by 2 (USE THE DOUBLE EQUAL SIGN!!!)// printf("Scores[%d]=%d\n", i, scores[i]); //prints the certain "i" values from the array before incrimenting the "i" BUT ONLY PRINTS DVISABLE BY 2// } sum+=scores[i]; //Sums all scores (divisable by 2 or not)// printf("Sum of values = %d\n", sum); //prints sum of all numbers because print sum statement// } }
run
|
edit
|
history
|
help
0
150108_RecursividadFibonacci
USO DEL strrchr()
2.3 Comparision with Matrix Multiplication Execution Time
iplk
Example array of struct print
Sunday assignment v2
faster posting list using skip pointers
2
linear hybrid cellular automaton reversible random bit generator stream cipher
02468