Write a c code segment using a for loop that calculates and
prints the sum of the even integers from 2 to 30, inclusive?
Answer Posted / parekh nirav
#include<stdio.h>
#include<conio.h>
void main()
{
int i,no,sum=0;
clrscr();
printf("\n entre the no:-");
scanf("%d",&no);
for(i=2;i<=30;i+1)
{
printf("\n the list is %d",i);
sum=sum+i;
}
printf("\n the sum is %d",sum);
getch();
}
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
Are the outer parentheses in return statements really optional?
Why isn't any of this standardized in c? Any real program has to do some of these things.
Is it fine to write void main () or main () in c?
Explain how can a program be made to print the line number where an error occurs?
What is static memory allocation? Explain
How can type-insensitive macros be created?
What is a loop?
What is null pointer in c?
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
difference between Low, Middle, High Level languages in c ?
what are the different storage classes in c?
what will be maximum number of comparisons when number of elements are given?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
Differentiate fundamental data types and derived data types in C.
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same