answersLogoWhite

0

void main ()

{

int no1, sum, n;

clrscr()

sum = 0;

n = 1;

printf("\n enter the number to which sum is to be generated");

scanf("%d",&no1);

while(n<=no1)

{

sum=sum+n;

n=n+1

}

printf("\n the sum of %d = %d, no1, sum");

getch ();

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

output of a c program using function to find factorial of a number?

In a C program that calculates the factorial of a number using a function, the program typically prompts the user for an integer input. The function then recursively or iteratively computes the factorial by multiplying the number by the factorial of the number minus one until it reaches one. For example, if the user inputs 5, the program outputs 120, as 5! = 5 × 4 × 3 × 2 × 1. The final result is displayed on the screen.


Which math function is used to find the square root of a number using java?

Math.sqrt(number) function is used to find the square root of a number.. try it


How do you write a c program to find area of rectangle using function?

There will be a function in it like this: double RectangleArea (double a, double b) { return a*b; }


How do you find by program a given number is integer or float?

If it contains a decimal point or an exponential part, then it should be handled as a float (or double).You can determine an existing variable's type in C using the type() function


Help I am using open office for PC and you cant find any function that will search the spreadsheet for a a number you put into a cell Is there a function for that?

It will find a number - if the number is not a formula. For example - if you search for the number 30 it will find it - BUT - if the product in a cell is the result of a formula it will disregard it.


Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?

Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?


Program to find biggest number among two numbers using template function?

template&lt;class T&gt; T&amp; max(const T&amp; x, const T&amp;y){return(x&gt;y?x:y); }


Write a Program in lisp to find remainder?

Here's a simple program in Lisp to find the remainder of two numbers using the mod function: (defun find-remainder (a b) (mod a b)) ;; Example usage: (find-remainder 10 3) ; This will return 1 This function find-remainder takes two arguments, a and b, and returns the remainder of a divided by b.


How do you find the value of a number in a function?

The number of function is Geometry


How can you program a TI-83 Plus to find area under a curve?

To program a TI-83 Plus to find the area under a curve, you can use the built-in integration functionality. Start by entering the function you want to integrate using the Y= menu. Then, create a new program by accessing the PRGM menu, selecting NEW, and entering your program name. In the program, use the fnInt command to calculate the integral, specifying the function, variable, lower limit, and upper limit. Finally, display the result using the Disp command.


Can somebody give me the program to find simple interest using friend function in c plus plus?

Here is an example program: class obj{ public: float p,n,r,si; friend void calc( obj temp); }; void calc( obj temp){ si = (p*n*r)/100; } The initialization and function calling is essential.


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers