Problem 42. C Program to accept values into 3 dimensional array and print .
#include<stdio.h>
#include<conio.h>
main( )
{
int a[3][3],i,j;
clrscr( );
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
{
printf(“ enter the value for a[%d][%d]:”,i,j);
scanf(“%d”,&a[i][j]);
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
printf(“ %d:”,a[i][j]);
printf(‘n”);
}
getch( );
}
C compiler: gcc 4.1.2
Back to main directory: Sample C Program | Software Practical | Solved C Assignment#include<stdio.h>
#include<conio.h>
main( )
{
int a[3][3],i,j;
clrscr( );
for(i=0;i<=2;i++)
for(j=0;j<=2;j++)
{
printf(“ enter the value for a[%d][%d]:”,i,j);
scanf(“%d”,&a[i][j]);
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
printf(“ %d:”,a[i][j]);
printf(‘n”);
}
getch( );
}
C compiler: gcc 4.1.2