Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to calculate the price of one mango

Posted By: Reamonn Fischer     Category: C Programming     Views: 2876

Write a program to calculate the price of one mango.

Code for Program to calculate the price of one mango in C Programming

#include<stdio.h>
void main()
{
    float pdz,pricepermg,nwprice,d,f;
    int nomg;
    printf("price of dozen");
    if(scanf("%f",&pdz)==1)
    {    
        printf("enter the number of mango");
        if(scanf("%d",&nomg)==1)
        {
            pricepermg=pdz/12;
            nwprice=pricepermg*nomg;
            printf("price= %d\n mango=%o.2f",nomg,nwprice);
        }
        else
        {
        printf("enter correct value");
        }
    }
    else
    {
    printf("Enter the correct value");
    }
}

================================OUTPUT===================================
price of dozen :23
enter the number of mango :23
price= 23
mango=44.08


price of dozen :12
enter the number of mango :45
price= 45
mango=45.00
  
Share: 


Didn't find what you were looking for? Find more on Program to calculate the price of one mango Or get search suggestion and latest updates.

Reamonn Fischer
Reamonn Fischer author of Program to calculate the price of one mango is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!