answersLogoWhite

0


Best Answer

#include <stdio.h>

#include <conio.h>

int main()

{

int iNum = 0, iSum = 0, iNVal = 0;

printf("Program to find the sum of first N numbers");

printf("\nEnter the number:");

scanf("%d",&iNum);

iNVal = iNum;

while(iNum)

{

iSum = iSum+iNum;

iNum--;

}

printf("\nSum of first %d number(s) is %d",iNVal,iSum);

getche();

return 0;

}

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find the sum of first 'n' nos?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you find the sum of nos in a series?

It depends on the series.


Find the sum of 1 plus 2 plus 3 plus . plus n nos using c program?

if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;


Write a programme to find the sum and product of three numbers?

//sum and product of 3 nos #include #include void main() { int a,b,c; printf("enter the 3 nos"); scanf("%d%d%d",&amp;a,&amp;b,&amp;c); printf("sum of 3 nos",a+b+c); printf("product of 3 nos",a*b*c); getch(); }


C program for summation of n nos using recursion?

int sum (int n) { if (n&lt;=1) return n; else return n + sum (n-1); }


Their sum is 0, and the product is -64 what is the value of both number?

The nos. Are 8 and -8 Sum of the nos. 8+(-8)=0 Product of the nos. 8 × (-8) = -64


The sum of six consecutive odd nos is 888 What is the average of the nos?

148


What are even nos between 100 to 300 that is the sum of two prime nos?

Each one of them can be expressed as a sum of two primes.


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


What is the first line of every FORTRAN program and what does it tell the compiler?

The name of the program. For example: program sum ! This is a comment. Your program's code goes here... end program sum


Write a program to find the sum of all positive number and terminate the program when sum exceed 999?

int sum = 0; int n = 0; while( sum &lt;= 999 ) { sum += (++n); }


Writes a c program to find the sum of all integers between 1 and n?

Write a program to find the number and sum of all integers from 100 to 300 that are divisible by 11


How can you Express 121 as a sum of 2 prime nos?

11x11