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 'lex' does?

710


what is the structure pointer?

1636


What is the use of sizeof () in c?

548


Explain can the sizeof operator be used to tell the size of an array passed to a function?

585


How do we declare variables in c?

558






program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)

1616


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1452


What is a void pointer? When is a void pointer used?

614


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2296


Who developed c language and when?

573


What does the error 'Null Pointer Assignment' mean and what causes this error?

732


Can you pass an entire structure to functions?

686


What do you mean by keywords in c?

614


What is meant by realloc()?

666


Compare array data type to pointer data type

592