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 are the properties of union in c?

0 Answers  


What is #define size in c?

0 Answers  


Write a C/C++ program that connects to a MySQL server and checks intrusion attempts every 5 minutes. If an intrusion attempt is detected beep the internal speaker to alert the administrator. A high number of aborted connects to MySQL at a point in time may be used as a basis of an intrusion.

2 Answers   Drona Solutions, Infosys, Vodafone, Webyog,


What is meant by global static? why we have to use static variable instead of Global variable

4 Answers   L&T,


What should not contain a header file?

2 Answers  






Write a C program in Fibonacci series.

0 Answers   iNautix,


What is the difference between pure virtual function and virtual function?

0 Answers  


How can I get the current date or time of day in a c program?

0 Answers  


write a program that will print %d in the output screen??

9 Answers   Infosys,


define switch statement?

6 Answers   CTS,


Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc

4 Answers  


#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}

3 Answers  


Categories