54321 4321 321 21 1
#include <stdio.h>
int main()
{
int i, j;
for(i=5;i>=1;i--)
{
for(j=i;j>=1;j--)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C
This comment has been removed by the author.
ReplyDeletefor(int i=1;i<=5;i++)
ReplyDelete{
for(int j=5;j>=i;j--)
System.out.print(j+1-i);
System.out.println();
}
54321
Deletetell me y u use "for(i=5;i>=1;i--) " y dont use for(i=1;i<=5;i++) ??????
ReplyDeleteDoes it make any difference? You can write it in many ways. This way stroked first to me
Delete#include
ReplyDeleteint main()
{
int r,i,j;
printf("Enter the number of rows : ");
scanf("%d",&r);
for(i=r;i>=1;i--)
{
for(j=i;j>=1;j--)
{
printf("%d",j);
}
printf("\n");
}
return 0;
}
#include
ReplyDeleteint main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int j=n-i+1;j>=1;j--)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
In C++ language;
ReplyDelete#include
using namespace std;
int main(){
int n;
cin >> n;
int i = 1;
while(i<=n){
int j = n-i+1;
while(j>0){
cout << j;
j--;
}
cout << endl;
i++;
}
}
Ethanks great site for coding
ReplyDelete