0

C professional please help me I'm beginner

Output Needed Input 10 integers in the array : array[0] : 1 array[1] : 3 array[2] : 5 array[3] : 7 array[4] : 9 array[5] : 11 array[6] : 13 array[7] : 15 array[8] : 17 array[9] : 19 No Even integers Found! Odd integers Found! The Odd integers are : 1 3 5 7 9 11 13 15 17 19

6th Dec 2021, 12:48 PM
錫闇
4 ответов
+ 1
I fixed your code but your problem is that you put the array "9" instead of "10". #include <stdio.h> #define SIZE 10 int main() { int array[SIZE], i, f; //printf("Input 10 integers in the array:\n"); for (i=0; i<SIZE; i++) { //printf("\narray[%d]: ", i); scanf("%d", &array[i]); //printf("%d ", array[i]); } f=0; for (i=0; i<SIZE; i++) if (array[i]%2==0) { if(f==0) { printf("\n\nThe Even integers are: \n"); f=1; } printf("%d ", array[i]); } if (f==0) printf("\n\nEven numbers not found!"); f=0; for (i=0; i<SIZE; i++) if (array[i]%2!=0) { if(f==0) { printf("\n\nThe Odd integers are: \n"); f=1; } printf("%d ", array[i]); } if (f==0) printf("\n\nOdd numbers not found!"); } https://code.sololearn.com/cti4Y4z5yt3g
6th Dec 2021, 2:15 PM
SoloProg
SoloProg - avatar
0
because they're not teaching me they only suggesting i said im begginer i dont much undestand what they're saying.. sorryyy ipost it because I thought somebody gonna solve it for me ;(
6th Dec 2021, 1:34 PM
錫闇