Two Dimension in 'C'
Two Dimension Array in 'C'
This is the C Program of Mine which is my practice of two dimension array.
*Coding Here*
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int Matrix[4][6];
int sum=0,rows,colm;
printf("This \"Matrix\" has 4 \"rows\" and 5 \"column\"\n\n");
for(rows=0;rows<=3;rows++)
{
for(colm=0;colm<=5;colm++)
{
printf("Enter Value for Matrix[%d][%d] : ",rows,colm);
scanf("%d",&Matrix[rows][colm]);
}
}
clrscr();
printf("\nThis \"Matrix\" has 4 \"rows\" and 5 \"column\"\n\n\t");
for(rows=0;rows<=3;rows++)
{
for(colm=0;colm<=5;colm++)
{
printf("%d\t",Matrix[rows][colm]);
sum=sum+Matrix[rows][colm];
}
printf("\n\t");
}
printf("\n\n\t\t ================================");
printf("\n\t\t The Sum of all Number is : %d",sum);
printf("\n\t\t ================================");
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int Matrix[4][6];
int sum=0,rows,colm;
printf("This \"Matrix\" has 4 \"rows\" and 5 \"column\"\n\n");
for(rows=0;rows<=3;rows++)
{
for(colm=0;colm<=5;colm++)
{
printf("Enter Value for Matrix[%d][%d] : ",rows,colm);
scanf("%d",&Matrix[rows][colm]);
}
}
clrscr();
printf("\nThis \"Matrix\" has 4 \"rows\" and 5 \"column\"\n\n\t");
for(rows=0;rows<=3;rows++)
{
for(colm=0;colm<=5;colm++)
{
printf("%d\t",Matrix[rows][colm]);
sum=sum+Matrix[rows][colm];
}
printf("\n\t");
}
printf("\n\n\t\t ================================");
printf("\n\t\t The Sum of all Number is : %d",sum);
printf("\n\t\t ================================");
getch();
}
....Enjoy My Program....
0 comments: