2.01.2012

Number triangle equal

Q. write a C following number triangle :
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5


Ans.


/*c program for number structure*/
#include<stdio.h>
#include<conio.h>
int main()
{
  int num,r,c;
  printf("Enter structure number : ");
  scanf("%d", &num);
  for(r=1; r<=num; r++)
  {
     for(c=1; c<=r; c++)
        printf("%d",r);
     printf("\n");
  }
  return 0;
}
Output:-
Enter structure number : 5

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

11 comments:

  1. i needed it so much.. thanks Mr. Dinesh
    ABDUL JUNAID

    ReplyDelete
  2. i am realy happy sir it make me happy

    ReplyDelete
  3. i am realy happy sir it make me happy

    ReplyDelete
  4. how can i progress in programming c sir please tell me the way...............

    ReplyDelete
  5. tell me how to develop this
    1
    1 3
    1 3 5
    1 3 5 7
    1 3 5 7 9

    ReplyDelete
  6. what if we are using foxpro ....

    ReplyDelete
  7. can you help how to get
    4
    3 4
    2 3 4
    1 2 3 4

    ReplyDelete
  8. can you help me to get
    4
    3 4
    2 3 4
    1 2 3 4

    ReplyDelete
  9. can you help how to get
    4
    3 4
    2 3 4
    1 2 3 4

    ReplyDelete