Saturday, March 6, 2021

C program to calculate the average of three numbers.

 

1.     Write a C program to calculate the average of three numbers.

 

#include<stdio.h>

#include<conio.h>

int main()

{

    int a,b,c;

    float d;

    printf("Enter first number: ");

    scanf("%d", &a);

    printf("Enter second number: ");

    scanf("%d", &b);

    printf("Enter second number: ");

    scanf("%d", &c);

    d=(a+b+c)/3;

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

    return 0;

}

No comments:

Post a Comment