Answer to Question #179879 in C for jhon

Question #179879

Write program using two dimensional arrays that determines the ODD numbers among 10 numbers inputted and prints the list of these ODD numbers.


1
Expert's answer
2021-04-09T13:35:47-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS