Code for sum of 1 to 10 digits(Using for loop)

Code for sum of 1 to 10 digits(Using for loop)

#include<stdio.h>
#include<conio.h>
void main()
{
    int i,s=0;
    for(i=1;i<=10;i++)
    {
        s=s+i;
    }
    printf("sum=%d",s);
    getch();
}


Output


Comments

Popular posts from this blog

Code for pattern 6

Code to check leap year