Answer to Question #188441 in C for Peter Paul Hisola

Question #188441

This is my code C++ for my assignment. Please help me to convert it to C code. Thank you!


#include <iostream>

using namespace std;



float f1(float a){

float s;

if (a<250)

s=a*0.11;

else

s=250*0.11+(a-250)*0.17;

return s;

& }



float f2(float a){

& return f1(a)*1.1;

& }


int main(void)

{

float a;

cout<<"enter the number of kilowatt hours consumed : ";

cin>>a;

cout<<"total amount: "<<f2(a)<<endl;

system ("PAUSE");


}

See more: C


1
Expert's answer
2021-05-03T04:32:04-0400
#include <stdio.h>
#include <stdlib.h>




float f1(float a)
{
    float s;
    if (a < 250)
        s = a * 0.11;
    else
        s = 250 * 0.11 + (a - 250) * 0.17;
    return s;
}


float f2(float a)
{
    return f1(a) * 1.1;
}


int main(void)
{
    float a;
    printf("enter the number of kilowatt hours consumed : ");
    scanf("%f", &a);
    printf("total amount: %f\n", f2(a));
    system ("PAUSE");
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS