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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

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

653


What is default value of global variable in c?

564


Why do we use namespace feature?

584


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

655


What is "Duff's Device"?

703






what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2008


how do you execute a c program in unix.

637


When a c file is executed there are many files that are automatically opened what are they files?

595


What is header file in c?

605


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

631


Is it possible to initialize a variable at the time it was declared?

757


Explain high-order and low-order bytes.

670


formula to convert 2500mmh2o into m3/hr

499


What are multidimensional arrays?

656


Why is structure important for a child?

604