So heres a question for c programming A grocery store is sel

So here\'s a question for c programming:

A grocery store is selling oranges for 9 cents apiece or one dollar per dozen.

a) Write a function that takes a single parameter - the number of oranges - and returns the total price for those oranges.

b) Write a program that prompts for a number of oranges, accepts input of an integer value, and outputs the total price for the oranges. Make sure your program calls the function you wrote in part a).

Solution

#include<stdio.h>
#include<conio.h>
int price;

int oranges(int n)

{

price = n * 9; // Price of orange be 9 cent

return price; // return price to calling method

}

int main() //Program starts

{

int orng ;

printf(\"Enter the no. of oranges\ \" );

scanf(\"%d\" , &orng);

oranges(orng); // function calling to calculate price

printf(\"The price of oranges is %d\" , price);
return 1;

}

So here\'s a question for c programming: A grocery store is selling oranges for 9 cents apiece or one dollar per dozen. a) Write a function that takes a single

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site