Computer Science, asked by TheSTrip28, 2 months ago

Write a C program to recieve two numbers from the user and calculate their average​

Answers

Answered by praneetkj24
0

Answer:

C Program to find the average of two numbers

Example Input: first Number: 12 second Number: 13 Output: The Product is: 12.50.

Output Enter the first number: 1 Enter the second number: 3 The Average of 1 and 3 is: 2.00.

Output Enter the first number: 5 Enter the second number: 4 The Average of 5 and 4 is: 4.50.

Explanation:

Answered by jahra805
1

Answer:

#include <stdio.h>

int main() {

   int num1,num2;

   float avg;

   printf("\n enter two numbers: \n");

   scanf("%d%d",&num1,&num2);

   avg =(float)(num1+num2)/2;

   printf("the average of two numbers are:%f",avg);

   

   return 0;

}

Explanation:  output

/* enter two numbers:  

5

6

the average of two numbers are:5.500000  */

  • we are using type conversion to convert integers to float
Similar questions