Monday, 5 April 2021

2D Array in C++

 #include<stdio.h>

#include<iostream.h>

#include<conio.h>

main()

{

clrscr();

int A[3][3];//={{1,2,3},{4,5,6},{7,8,9}};

int i,j;

cout<<"Enter 9 numbers\n";


for(i=0;i<=2;i++)

{

for(j=0;j<=2;j++)

{

cin>>A[i][j];

}

}

cout<<"Array is\n";

for(i=0;i<=2;i++)

{

for(j=0;j<=2;j++)

{

cout<<A[i][j]<<"\t";

}

cout<<endl;

}

getch();

return 0;

}

No comments:

Post a Comment