Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to calculate average of numbers given by user using while loop

Posted By: Lilly Campbell     Category: C Programming     Views: 42278

Write a program to calculate average of numbers given by user using while loop.

Code for Program to calculate average of numbers given by user using while loop in C Programming

#include<stdio.h>
#include<conio.h>
#define N 10                         /*    SYMBOLIC CONSTANT*/
void main() { clrscr(); int count; float sum,average,number; sum=0; count=0; while(count<N) { scanf("%f",&number); sum=sum+number; count=count+1; } average=sum/N; printf("N=%d Sum=%f",N,sum); printf(" Average=%f",average); getch(); }
  
Share: 



Lilly Campbell
Lilly Campbell author of Program to calculate average of numbers given by user using while loop is from Toronto, Canada.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!