top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to get following output (Reverse Triangle) using C?

+1 vote
210 views

11111
2222
333
44
5

posted Dec 8, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
main()
{
     int i,j,k;
     for(i=5,k=1;i>0,k<6;i--,k++)
     {    
       for(j=i;j>0;j--)
       {
             printf("%d ",k);
       }
       printf("\n");
     }    
}
answer Dec 9, 2014 by Sridharan P
+1 vote
#include<stdio.h>
main()
{
    int i,j;
    for(i=1;i<=5;i++)
    {
        for(j=5;j>=i;j--)
        {
          printf("%d ",i);
        }
        printf("\n");
    }
}
answer Dec 9, 2014 by Chirag Gangdev
Similar Questions
+2 votes
struct marks {
  int a:1;
  int b:2;
};

int main() {
  struct marks obj={1,6};
  printf("%d %d\n",obj.b,obj.a);
}
+1 vote
1*8+1= 9
12*8+2=98
123*8+3=987
1234*8+4=9876
12345*8+5=98765
123456*8+6=987654
1234567*8+7=9876543
12345678*8+8=9876543 2
123456789*8+9=987654 321
...