Pages

natural numbers

How to add natural numbers upto 10.

#include<stdio.h>
#include<conio.h>
void main()
{
                int i=1,sum=0;
                clrscr();
                for(i=1;i<=10;i++)            
{
                Sum=sum+I;
}
printf(“Sum of 10 natutral numbers  is : %d”,sum);
               
                getch();
}


No comments:

Post a Comment