Saturday, March 6, 2021

C program to find the average of any two numbers given by the user.

 

 

1.     Write a C program to find the average of any two numbers given by the user.

 

#include<stdio.h>

#include<conio.h>

int main()

{

    int a,b;

    float c;

    printf("Enter first number: ");

    scanf("%d", &a);

    printf("Enter second number: ");

    scanf("%d", &b);

    c=(a+b)/2;

    printf("Average of two numbers= %.2f",c);

    return 0;

}

No comments:

Post a Comment