Write program using two dimensional arrays that determines the ODD numbers among 10 numbers inputted and prints the list of these ODD numbers.
#include <stdio.h>
int main(){
//two dimensional arrays
int numbers[2][5];
int i,j;
int number;
//read the number from the keyboard
for(i=0;i<2;i++){
for(j=0;j<5;j++){
printf("Enter array number[%d][%d]: ",i,j);
scanf("%d", &number);
numbers[i][j]=number;
}
}
printf("\n");
// determines the ODD numbers among 10 numbers inputted and prints the list of these ODD numbers.
for(i=0;i<2;i++){
for(j=0;j<5;j++){
if(numbers[i][j]%2==1){
printf("Array number[%d][%d] = %d is ODD number.\n",i,j,numbers[i][j]);
}
}
}
getchar();
getchar();
return 0;
}
Comments
Leave a comment