Circuit Negma

C++, C, VB.NET, PCB, Electronics, Circuit Design

arrays

Posted by Circuit Negma on February 6, 2006


#include <stdio.h>

main()
{
       char grid[8][3];        // this is a 8*3 array.
       int i;
       int j;
       
       for(i = 0; i < 8; i++)
       {
            printf("\n");
            for(j = 0; j < 3; j++)
            {
                printf("enter the contents of row %d column %d: ", i+1 ,j+1);
                fflush(stdin);
                scanf("%d", &grid[i][j]);
            }
      }
      
      printf("\n\n");
                printf("****************************************\n");
      
      for(i = 0; i < 8; i++)
      {
            printf("\n");
            for(j = 0; j < 3; j++)
                printf("%3d   ", grid[i][j]);  //prints the output in 3 equal spaced spaces.
      }
      
      printf("\n\n\n");
      
      fflush(stdin);
      getchar();
}


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: