Write a c program to computer the average of every third integer laying between 1 and 200 include appropriate documentation using looping
Answers
Answered by
1
Answer in programming c
Read While loop
Program :
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
for(a=1,b=0,c=0;a<=200;a+=3)
{
c+=a;
b++;
}
printf("\n\tAverage of every third integer between 1 to 200 is %d",c/b);
getch();
}
---------------------'End---------------------------------
Explanation:
Variable a is used for count 1 to 200
variable c is sum of every third integer . get by a because a is incremented by 3 in each loop turn.
Variable b is used to trace how many third number are in range of 1 to 200
As we know formula of calculating average is sum of value divided by number of element is perform while printing
plz mark me as brainiliest
Similar questions