Sequences producing

54321
54321
54321
54321

54321


#include"stdafx.h"
#include<iostream>
usingnamespace std;
int main()
{
for(int i=1; i<=5; i++)
{
for(int j=1; j<=5; j++)
{
cout<<(5-j)+1;
}
cout<<endl;
}

system("pause");
return  0;
}


1
21
321
4321
54321
#include"stdafx.h"
#include<iostream>
usingnamespace std;
int main()
{
for(int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
cout<<(i-j)+1;
}
cout<<endl;
}

system("pause");
return  0;
}

12345
1234
123
12
1

#include"stdafx.h"
#include<iostream>
usingnamespace std;
int main()
{
for(int i=1; i<=5; i++)
{
for(int j=1; j<=6-i; j++)
{
cout<<j;
}
cout<<endl;
}
system("pause");
return  0;
}

1
12
123
1234
12345
#include"stdafx.h"
#include<iostream>
usingnamespace std;
int main()
{
for(int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
cout<<j ;
}
cout<<endl;
}
system("pause");
return  0;
}

No comments:

Post a Comment