fork download
  1.  
  2. #include<stdio.h>
  3. int front(int r)
  4. {
  5. int i,j,count=0;
  6. for (i = 0; i < r; i++)
  7. {
  8. for (j = 0; j <= i; j++)
  9. {
  10. count++;
  11. if (j != 0)
  12. printf ("*%d", count);
  13. else
  14. printf ("%d", count);
  15. }
  16. printf ("\n");
  17. }
  18. }
  19.  
  20. int reverse(int r)
  21. {
  22. int i,j,count=11;
  23. for (i = r; i >0; i--)
  24. {
  25. for (j =i ; j >0; j--)
  26. {
  27. count--;
  28. if (j != 1)
  29. printf ("%d*", count);
  30. else
  31. printf ("%d", count);
  32. }
  33. printf ("\n");
  34. }
  35. }
  36.  
  37. int main ()
  38. {
  39. int i, j, r, count;
  40. //count = 0;
  41. printf ("Enter the number of rows :\n");
  42. scanf ("%d", &r);
  43. front(r);
  44. reverse(r);
  45.  
  46. }
  47.  
Success #stdin #stdout 0s 9424KB
stdin
4
stdout
Enter the number of rows :
1
2*3
4*5*6
7*8*9*10
10*9*8*7
6*5*4
3*2
1