Working with Floats


  1. Get the average of two numbers

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float no1,no2,avg;

    printf("Enter Number 1\n");
    scanf("%f",&no1);

    printf("Enter Number 2\n");
    scanf("%f",&no2);

    avg=(no1+no2)/2;

    printf("The Average Is %f\n",avg);
    return 0;

}

No comments:

Post a Comment