Program to Print the Number from 1 to 10
Write a program to print the number from 1 to 10, and also display its total Value?
Answers
Answered by
0
simply start as
#include<stdio.h>
void main()
{
int i,n, sum=0;
clrscr();
for(i=1;i<=10;i++)
{
printf("%d\n",i);
sum=sum+i;
}
printf("sum is%d",sum);
getch();
}
#include<stdio.h>
void main()
{
int i,n, sum=0;
clrscr();
for(i=1;i<=10;i++)
{
printf("%d\n",i);
sum=sum+i;
}
printf("sum is%d",sum);
getch();
}
Similar questions