answersLogoWhite

0


Best Answer

to print the sum of first ten numbers:-

void main()

{int i,sum;

sum=0;

while(i<=10)

sum=sum+i;

i=i+1;

}

printf("The sum is : %d",sum);

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

int sumNums(int n) {

int sum = 0;

while(n >= 1) {

sum += (n--);

}

return sum;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Create a program that will display the sum of all numbers from 1 up to the input number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program for which give number in ascending number?

the following program will display all numbers given in the array in ascending order #include&lt;stdio.h&gt; void main() { int i,h,p; int numbers[10]={5,8,3,2,6,7,9,4,1,10}; for(p=0;p&lt;=8;p=p+1) { for(i=0;i&lt;=8;i=i+1) { if(numbers[i]&gt;numbers[i+1]) { a=numbers[i]; numbers[i]=numbers[i+1]; numbers[i+1]=a; } } } for(i=0;i&lt;=9;i=i+1) { printf("%d ",numbers[i]); } }


Write a program which takes any number of days from the user the program should display the number of years number of months formed by these days as well as the remaining days?

Write a program which takes any number of days from the user. the program should display the number of years, number of months formed by these days as well as the remaining days.


How can I write a program to display prime numbers from 1 to 100?

Write a function that implements an algorithm that checks to see if a particular integer is prime (returning a boolean). Write a program that uses that function on each number from 1 to 100, and if true, displays that number.


When does cell display number signs in Excel?

When the cell is not wide enough to display the numbers that are in it. Widening the column will enable you to see the numbers properly.


What is the program to find sum of n natural numbers in c plus plus?

Initialise an unsigned integer to zero. As each number is input, increment the running total accordingly. When all numbers are input, display the total.


Draw a flowchart to accept 3 numbers and display the largest number?

draw a flowchart to display the first tenth even number


Write an algorithm to read two numbers then display the largest?

Read 2 numbers. If first is larger than second, display second, else display first. That's for the smallest. For the largest reverse the two. For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest. Best answer Read 2 numbers. If first is larger than second, display second, else display first. That's for the smallest. For the largest reverse the two. For each of the other two, it's easier to just create a variable, call it largest. Initialize it to a very small number, say -1. As you read each number, compare it to largest. If the number is larger than largest, set largest equal to the number. When you finish each list of numbers, then print largest.


Create a program which accepts a number not less than 10The program prints the reverse of the number?

ten


Write a program to display the name of days when a user enters a number?

write a program to display your name age class schoolname e-mail 2hobby based on choice


Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Simple c programs for practice?

Accept a number. Display all numbers from 0 up to it. Example: If input number is 5, output should be 0 1 2 3 4Accept two numbers. Display all numbers between them. Example: If input numbers are 10 and 15, output should be 11 12 13 14Accept a number. Display all even numbers less than that number. Example: If input number is 7, output should be 2 4 6Accept a number and display its multiplication table. Example: If input number is 3, output should be 3 X 1 = 3, 3 X 2 = 6..... [For/while loop needed]Accept a number and find the sum of all numbers from 0 till that number. If input number is 3, output should be 6 (0 + 1 + 2 + 3)Create two int variables a and b, each = 30000. Try to assign c = a +b. Display c. Answer is not 60000. Why?Good luck.


What is required to operate a boat in Maryland?

certificate of number