033. Write a program to print sum of given first n numbers in C language

#include<stdio.h> 
#include<conio.h>
main()
{
 int n,newn,i,sum=0;
 clrscr();
 printf("Enter number : ");
 scanf("%d",&n);
 printf("Numbers entered....\n");
 for(i=1;i<=n;i++)
 {
	scanf("%d",&newn);
	sum=sum+newn;
 }
 printf("Sum of given n digits is... %d",sum);
}

2 thoughts on “033. Write a program to print sum of given first n numbers in C language

Leave a Reply

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