Computer Science, asked by gauravtamang7182, 11 months ago

Write a program to perform addition of first 10 even numbers

Answers

Answered by SamikBiswa1911
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 rakeshchennupati143
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
SamikBiswa1911: thanku
rakeshchennupati143: for what?
SamikBiswa1911: for mentioning the language
SamikBiswa1911: that i don't
rakeshchennupati143: you don't know python yet you know c ?
SamikBiswa1911: yes my mistake
Similar questions