Write a programe print the sum of series 0,1,2,.....10
Answers were Sorted based on User's Feedback
Answer / nithya
#include<stdio.h>
main()
{
int i,sum=0;
printf("sum of the series is");
for(i=0;i<10;i++)
{
sum=sum+i;
printf("%d",sum);
}
| Is This Answer Correct ? | 16 Yes | 5 No |
Answer / athiyaman
#include<stdio.h>
void main()
{
int i,sum=0;
for(i=0;i<=10;i++)
sum=sum+i;
printf("sum=%d",sum);
}
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / manjushree
Answer #2 doesnot count for integer 10.
int main()
{
int i,temp=0;
printf("sum of series is:");
for(i=0;i<10;i++)
temp+=i;
printf("%d",temp);
getch();
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / akash patil
#include<stdio.h>
voind main()
{
int n=10;
printf("sum is %d",n*(n+1)/2;
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
Answer / sevak.yatrik777
main()
{
int i;
printf("sum of series is:");
for(i=0;i=10;i++)
i=i+i;
scanf("%d",&i);
printf("%d",i);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / s.m.jyo
main()
{
int i;
printf("sum of series is:");
for(i=0;i=10;i++)
i=i+i;
scanf("%d",&i);
printf("%d",i);
}
| Is This Answer Correct ? | 7 Yes | 9 No |
Can a program have two main functions?
What is quick sort in c?
What does 3 mean in texting?
Why do we use & in c?
How to write a code for reverse of string without using string functions?
How can you find out how much memory is available?
Why header file is used in c?
how to find the sizof of any datatype using bit manipulations
What is pointer to pointer in c language?
how to find binary of number?
f(char *p) { p=(char *)malloc(sizeof(6)); strcpy(p,"HELLO"); } main() { char *p="BYE"; f(p) printf("%s",p); } what is the output?
9 Answers Hughes, Tech Mahindra,
What is variable in c example?