IGNOU Assignment Answers and free solutionsCategory: AssignmentDraw a flow chart and write an algorithm for a program that adds 10 even numbers starting from 2. (You must use looping).
Amit Kumar Staff asked 1 year ago

Draw a flow chart and write an algorithm for a program that adds 10 even numbers starting from 2. (You must use looping).

1 Answers
Best Answer
C-loop answered 1 year ago

/* QN 5   FIRST 10 EVEN NUMBER AND THEIR SUM */
#include<stdio.h>
#include<conio.h>
void main()
{    
  int i,n,t=0,sum=0;
clrscr();
printf(“First 10 even number is:\n”);
for (i=1;i<=10;i++)
{       t+=2;
printf(“%4d”,t);
sum +=t;
}
printf(“\n\nThe sum of = %d\n”,sum);
getch();
}

View Fullscreen