Write a C program to print all the numbers upto the inputted number

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

yashan has written 70 articles

1 thoughts on “Write a C program to print all the numbers upto the inputted number

Cancel reply

Leave a Reply to harish

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>