Write a program in the C programming language to print all the numbers up the inputted number by using for loop. This code illustrates the use of the for loop. Below is the solution of the program –
/* Write a C program to print all the numbers up to the inputted number*/ #include<stdio.h> void main() { int n,i; printf("Enter any Number \n"); scanf("%d",&n); for(i=0;i<=n;i++) { printf("%d \t",i); } getch(); }
Input – 10
Output – 1 2 3 4 5 6 7 8 9 10
i want program by output as
1
01
010
1010
10101
010101
0101010