How to calculate total and average price:-

CODE




How to calculate total and average price:-
Input price of laptop,mobile and book and find out total price and average price.

int main()
{
    float t,l,m,b,avr;
    printf("\nenter the price of laptop,mobile and books:");
    scanf("%f%f%f",&l,&m,&b);
    t=l+m+b;
    avr=t/3;
    printf("\nTotal price:%f",t);
    printf("\nAverage price:%f",avr);
}


Output:-
Enter the price of laptop,mobile and books:40000
20000
4000

Total price:64000.000000
Average price:21333.333984

How to calculate total and average price:- How to calculate total and average price:- Reviewed by Unknown on December 13, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.