//PROGRAM TO ADD 10 TO EACH ELEMENT OF A 2-D ARRAY AND PRINT IT IN MATRIX FORM
#include<conio.h>
#include<stdio.h>
void main()
{
int ar[10][10],i,j,row,col;
clrscr();
printf("enetr the no of rows\n");
scanf("%d",&row);
printf("enter the no of cols\n");
scanf("%d",&col);
printf("enter the elements of 2d array\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&ar[i][j]);
}
}
printf("the elements of 2d array are\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
printf(" %d ",ar[i][j]+10);
}
printf("\n\n");
}
getch();
}
#include<conio.h>
#include<stdio.h>
void main()
{
int ar[10][10],i,j,row,col;
clrscr();
printf("enetr the no of rows\n");
scanf("%d",&row);
printf("enter the no of cols\n");
scanf("%d",&col);
printf("enter the elements of 2d array\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&ar[i][j]);
}
}
printf("the elements of 2d array are\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
printf(" %d ",ar[i][j]+10);
}
printf("\n\n");
}
getch();
}
No comments:
Post a Comment