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 happens if a header file is included twice?

0 Answers  


What is the relation between # and include<stdio.h>

5 Answers   HCL,


In c programming language, how many parameters can be passed to a function ?

0 Answers  


Which of the following is not a valid declaration for main ()? 1) int main() 2) int main(int argc, char *argv[]) 3) They both work

2 Answers  


what are the general concepts of c and c++

2 Answers  






2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. &#61550; Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. &#61550; When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. &#61550; Sequence of take-off is the sequence of addition to the waitlist

0 Answers  


main() { clrscr(); } clrscr();

6 Answers   ME, Wipro,


What is the right type to use for boolean values in c? Is there a standard type?

0 Answers  


What are bit fields? What is their use?

2 Answers   Adobe,


what do you mean by defining a variable in our c code?

2 Answers  


main() { printf("hello%d",print("QUARK test?")); }

5 Answers  


what is the little endian and big endian?

1 Answers  


Categories