Get the following Output:
5
5 10
5 10 15
5 10 15 20
5 10 15 20 25
Source Code:
25. Using For Loop
#include <stdio.h> int main() { int i,j; for(i=1;i<=5;i=i+1) { for(j=1;j<=i;j++) { printf("%d ",j*5); } printf("\n"); } return 0; }
Source Code:
26. Using While Loop
/* using while loop */ #include <stdio.h> int main() { int i=1,j; while(i<=5) { j=1; while(j<=i) { printf("%d ",j*5); j++; } printf("\n"); i++; } return 0; }
Get the following Output:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Source Code:
27. Using For Loop
#include <stdio.h> int main() { int i,j; for(i=1;i<=5;i=i+1) { for(j=1;j<=i;j++) { printf("%d ",i); } printf("\n"); } return 0; }
Source Code:
28. Using While Loop
/* using while loop */ #include <stdio.h> int main() { int i=1,j; while(i<=5) { j=1; while(j<=i) { printf("%d ",i); j++; } printf("\n"); i++; } return 0; }
Get the following Output:
2
4 4
6 6 6
8 8 8 8
10 10 10 10 10
Source Code:
29. Using For Loop
#include <stdio.h> int main() { int i,j; for(i=1;i<=5;i=i+1) { for(j=1;j<=i;j++) { printf("%d ",i*2); } printf("\n"); } return 0; }
Source Code:
30. Using While Loop
/* using while loop */ #include <stdio.h> int main() { int i=1,j; while(i<=5) { j=1; while(j<=i) { printf("%d ",i*2); j++; } printf("\n"); i++; } return 0; }