answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

int main()

{

long int num,sum;

clrscr();

printf("ENTER ANY NUMBER\n");

scanf("%ld",&num);

sum=(num*(num+num))/2;

printf("Sum of the given range is %d",sum);

getch();

}

by dilkash

from MANUU.

for(int i=0;;i++)

{

i+=i;

}

///////but you have to write condition or the number to stop looping

User Avatar

Wiki User

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

Wiki User

14y ago

#inlcude<stdio.h>

#include<conio.h>

int main()

{

int a,b=0,n;

printf("enter a number\n");

scanf("%d",&n);

while(n>=1)

{

a=n%10;

b=b+a;

n=n/10;

}

printf("sum of the digit is%d",b);

getch();

return(0);

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#include <stdio.h>

int main()

{

int total=0, i;

for (i=1;i<=100;++i) total+=i;

printf("%d\n",total);

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program to calculate the sum of the integer from 1 to 100?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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.


How do you write 100 as an integer?

The integer (numeral) version is 100, and the written spelling is "one hundred" or "hundred."


How do you write percentage number as an integer?

To write a percentage number as an integer, you can simply remove the percentage sign and divide the number by 100. For example, to write 75% as an integer, you divide 75 by 100, which equals 0.75.


Is 100 a perfict square?

Why not try it out? See if you can find an integer which, when squared, gives you 100. Or: use a calculator and calculate the square root of 100. If you get an integer, then the answer to the question is "yes"; otherwise the answer is "no".


How do you find sum of 100 numbers using fortran programme?

The following is for F95 and later (due to the use of intrinsic SUM ): My assumptions: -Your numbers are integers -Your numbers are stored in an array -The numbers you are describing are 0-100 program findSum !I assumed integer, replace this with your data type integer, dimension(100) :: numbers integer :: sumOfNumbers !We populate an array with our numbers !Replace this with your numbers do i=1,(size(numbers)+1) numbers = i end do !We find the sum of those numbers sumOfNumbers = sum(numbers) !We write out the sum to prompt write(*,*) 'Sum is: ', sumOfNumbers end program findSum


How do you write a c program to calculate income tax using a function?

float income_tax (float income, float tax_percent) { return income * tax_percent / 100; }


What is the largest integer less than or equal to -100?

The largest integer equal to -100 is -100. The largest integer less than -100 is -101.


What is the sie of an array whos upper bound is 100?

To calculate the size of array the type of array should be given. Ex: if it is of integer type that means int arr[100] and integer is of 4 bytes, then the size of array will be 400 bytes.


Is square root of a 100 is a integer?

Is the square root of a 100 is a integer


How do you write 53100 in simplest form?

53100 is an integer and so is in its simplest form.


What is an integer of 100?

100 IS an Integer. An integer is any positive or negative whole number (not a fraction number, and not zero).


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?