Right Click to Search

Saturday, July 31, 2024

C Program To Print First 10 Natural Numbers


C Program to print first 10 Natural Numbers without using Conditional Loop
Using For Loop
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
clrscr();
for(i=1;i<=10;i++)
  printf("%d",i);
getch();
}

Using While Loop
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
clrscr();
while(i<=10)
  {
  printf("%d",i);
  i++;
  } 
getch();
}

Using Do-While Loop
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
clrscr();
do{
  printf("%d",i);
  i++;
  }while(i<=10); 
getch();
}

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates