C Program To Find Average Of 2 Numbers
C Program To Find Average Of 2 Numbers
/* Author --> HARSH PATEL */
#include <stdio.h>
int main()
{
int num1,num2;
float average;
printf("Enter the First Num to find Average = ");
scanf("%d",&num1);
printf("Enter the Second Num to find Average = ");
scanf("%d",&num2);
int sum = num1 + num2;
average = sum/2;
printf("The Average of %d and %d = %.2f\n", num1, num2, average);
return 0;
}
output-1
Enter the First Num to find Average = 10
Enter the Second Num to find Average = 30
The Average of 10 and 30 = 20.00
output-2
Enter the First Num to find Average = 65
Enter the Second Num to find Average = 15
The Average of 65 and 15 = 40.00
•now the program ends without any error.