how to print 2-D array using a single for loop?
Answer Posted / tknowledge05
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3]={2,4,5,7,2,9,2,3,2};
int f=0,i;
printf("\n");
for(i=0;f!=3;i++)
{
if(i==3)
{f++;
printf("\n");
i=0;
}
printf("%d ",a[f][i]);
}
getch();
}
| Is This Answer Correct ? | 21 Yes | 4 No |
Post New Answer View All Answers
What is the difference between text and binary modes?
What is difference between %d and %i in c?
program for reversing a selected line word by word when multiple lines are given without using strrev
Do you know pointer in c?
How can you increase the size of a statically allocated array?
What kind of structure is a house?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
In a switch statement, explain what will happen if a break statement is omitted?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What is c mainly used for?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
What are qualifiers?
What is spark map function?
What does 3 periods mean in texting?