Programmin-in-Python

C Program to print Floyd's Triangle using natural numbers

Jan 8th, 2022
1,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.23 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(){
  3.     int n, x=1;
  4.  
  5.     printf("Enter the value of n : ");
  6.     scanf("%d", &n);
  7.  
  8.     for (int i=1; i<=n; i++){
  9.         for (int j=1; j<=i; j++){
  10.             printf("%d ", x);
  11.             x++;
  12.         }
  13.         printf("\n");
  14.     }
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment