Write a programe print the sum of series 0,1,2,.....10

Answer Posted / mrs.ahmer

#include<stdio.h>
#include<conio.h>
void main()
{
int c,sum;
clrscr();
c=0;
sum=0;
while(c<=10)
{
printf("%d\n",c);
sum=sum+c;
c=c+1;
}
printf("sum is %d",sum);
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does a pointer variable always consist of?

659


Explain how can a program be made to print the line number where an error occurs?

690


What is the difference between ‘g’ and “g” in C?

2510


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

654


writ a program to compare using strcmp VIVA and viva with its output.

1519






What are the valid places to have keyword “break”?

647


What are the types of i/o functions?

677


Explain how can type-insensitive macros be created?

567


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

652


How do you convert strings to numbers in C?

705


Difference between Function to pointer and pointer to function

625


Write a program to check prime number in c programming?

594


What is a protocol in c?

552


What is boolean in c?

603


What is the difference between array and pointer?

562