Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between text and binary modes?

1148


What is difference between %d and %i in c?

1197


program for reversing a selected line word by word when multiple lines are given without using strrev

2440


Do you know pointer in c?

1009


How can you increase the size of a statically allocated array?

1055


What kind of structure is a house?

1008


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.

3087


In a switch statement, explain what will happen if a break statement is omitted?

1015


.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

1248


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

1012


What is c mainly used for?

1012


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

1098


What are qualifiers?

993


What is spark map function?

1077


What does 3 periods mean in texting?

1025