Write a program to perform addition of first 10 even numbers
Answers
Answered by
2
Explanation:
Find First 10 Even Numbers and get their sum using for loop
/* 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();
}
Answered by
0
Program
sum = 0
for i in range(0,19,2):
sum = sum + i
print(sum)
Output:
90
Language
Python 3
-------Hope this helps :)
rakeshchennupati143:
You did not mentioned the language to be used so i wrote it in python
Similar questions
Math,
6 months ago
Science,
6 months ago
Computer Science,
1 year ago
Social Sciences,
1 year ago
Social Sciences,
1 year ago
Biology,
1 year ago