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);
if(i!=(n-1))
{
cout<<"*";
}
}
cout<<"\n";
val=n+n+1;
for(i=1;i<n-1;i++)
{
for(j=0;j<n;j++,val++)
{ cout<<val;
if(j!=(n-1))
{
cout<<"*";
}
}
cout<<"\n";
}
val=n+1;
for(i=0;i<n;i++)
{
cout<<(val+i);
if(i!=(n-1))
cout<<"*";
}
cout<<"\n";
}
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);
if(i!=(n-1))
{
cout<<"*";
}
}
cout<<"\n";
val=n+n+1;
for(i=1;i<n-1;i++)
{
for(j=0;j<n;j++,val++)
{ cout<<val;
if(j!=(n-1))
{
cout<<"*";
}
}
cout<<"\n";
}
val=n+1;
for(i=0;i<n;i++)
{
cout<<(val+i);
if(i!=(n-1))
cout<<"*";
}
cout<<"\n";
}
No comments:
Post a Comment
we are hear to discuss your queries ,so please feel free to ask any of your queries.