Calculate average of numbers

C program to calculate average of numbers :

code

#include<stdio.h>

#include<conio.h>

void main()

{

int  a,b,c,total,avg;

clrscr();

printf(‘Enter first value :\n”);

scanf(“%d”,&a);

printf(“Enter second value :\n”);

scanf(“%d”,&b);

printf(“Enter third value :\n”);

scanf(“%d”,&c);

 

total=a+b+c;

avg=total/3;

printf(“Average of  number is %d”,avg);

getch();

}


output

Enter first value :

20

Enter second value :

23

Enter third value :

20

Average of number is 21

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s