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

What is c programming structure?

0 Answers  


Why is void main used?

0 Answers  


Is it possible to create recycle bin in mobiles?

2 Answers  


What do you mean by dynamic memory allocation in c? What functions are used?

0 Answers  


Find the middle node in the linked list?? (Note:Do not use for loop, count and count/2)

6 Answers   Subex,






What is structure packing ?

2 Answers   HP,


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

0 Answers  


Find occurence of a character in a sting.

3 Answers   TCS,


Write a program with dynamically allocation of variable.

0 Answers   Atos Origin,


if we take a number as a char then can we manipulate(add, subtract) on this number

2 Answers  


How to receive strings with spaces in scanf()

7 Answers  


Are bit fields portable?

0 Answers   EXL,


Categories