c program to input values in a table(using 2D array) and print odd numbers from them



c program to input values in a table(using 2D array) and print odd numbers from them..

Answer / ashu

void main()
{
int a[10][10],i,j,n;
clrscr();
printf("enter the no. of elements:");
scanf("%d",&n);
printf("Enter the elements:");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Odd no.:");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]%2==0)
{
printf(" ");
}
else
{
printf(" %d",a[i][j]);
}
}
}
getch();
}

Is This Answer Correct ?    7 Yes 1 No

Post New Answer

More C Interview Questions

differnce between do and do while

3 Answers   DOEACC,


Distinguish between actual and formal arguments.

0 Answers  


What is the difference between scanf and fscanf?

0 Answers  


Which is better malloc or calloc?

0 Answers  


Program to swap the any two elements in an array containing N number of elements?

1 Answers   Bosch, Glenwood, Ugam Solutions,


What does struct node * mean?

0 Answers  


int array[]={1,2,3,4,5,6,7,8}; #define SIZE (sizeof(array)/sizeof(int)) main() { if(-1<=SIZE) printf("1"); else printf("2"); }

2 Answers   Vector,


Can an array be an Ivalue?

0 Answers   EXL,


please can some one guide me, to the answer Write a C program to enter 15 numbers as an input from the keyboard and program will find and print odd numbers and their average. i have studied while and do while loop for loop if and else if switch

2 Answers  


How do I send escape sequences to control a terminal or other device?

0 Answers  


What is undefined behavior?

1 Answers  


Display names and numbers of employees who have 5 years or more experience and salary less than Rs.15000 using array of structures (name, number, experience and salary)

1 Answers  


Categories