Tuesday, 9 December 2014

C Program to print average of two numbers

Program to print average of two numbers
#include<stdio.h>
main()
{
 int a,b;
 float c;
 printf("enter two values:\n");
 scanf("%d%d",&a,&b);
 c=(float)(a+b)/2;
 printf(" average of first two numbers is %f",c);
} 
OutPut:
enter two values:
1
24 
 average of first two numbers is 12.500000