Output Pattern:
1 2 3 4 5
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
6 7 8 9 10
Code for Above Pattern:
#include<iostream>
using namespace std;
int main()
{
int i=0,j=0,k=0,n=5;
int val=1;
for(i=0;i<n;i++)
{
cout<<(i+1)<<" ";
}
cout<<"\n";
val=n+n+1;
for(i=1;i<n-1;i++)
{
for(j=0;j<n;j++,val++)
{
cout<<val<<" ";
}
cout<<"\n";
}
val=n+1;
for(i=0;i<n;i++)
{
cout<<(val+i)<<" ";
}
cout<<"\n";
}
No comments:
Post a Comment
we are hear to discuss your queries ,so please feel free to ask any of your queries.