Write a program to calculate Average of Numbers.

A program to calculate the average of a set of N numbers ...

#include <stdio.h>
#define N 10
main()
{
int count;
float sum, average, number;
sum =0;
count =0;
while( count &lt;&gt;
{
scanf( "%f",&number);
sum = sum + number;
count = count + 1;
}
average = sum/N ;
printf("N = %d Sum = %f", N, sum);
printf(" Average = %f", average);
return 0;
}

Output:

1
2.3
4.67
1.42
7
3.67
4.08
2.2
4.25
8.21

N = 10 Sum = 38.799999 Average = 3.880000

0 comments:

Post a Comment

 

About Me

It's Me!Hi, I'm Moinuddin. I'm a Software Engineer at WIPRO working on Microsoft .NET Technology. I'm interested in a wide range of technology topics, mainly Microsoft including Windows Azure, WCF, WPF, Silverlight and any other cool technology that catches the eye.

Site Info

ProjectCSharp.com is mainly about demonstrating real time examples in different technologies like ASP.NET, WCF, WPF, Silverlight, Azure etc..,

Followers

Help Links

Project CSharp (C#) Copyright © 2011. All Rights Reserved.