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

Is c procedural or object oriented?

0 Answers  


Why main is not a keyword in c?

0 Answers  


Compare interpreters and compilers.

0 Answers  


Is flag a keyword in c?

0 Answers  


enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above

8 Answers   HCL, Wipro,






What is p in text message?

0 Answers  


How can I dynamically allocate arrays?

0 Answers  


What is #line in c?

0 Answers  


How can I send mail from within a c program?

0 Answers  


write a program to insert an element at the specified position in the given array in c language

5 Answers   Appin, IBM,


WHAT IS HEADER?

8 Answers   ProKarma, TCS,


what is the code to display color fonts in the output?

1 Answers  


Categories