Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Spring 2017 Lab 4 v1.1
//gcc 5.4.0 #include <stdio.h> //Start Program //char Customer_ID //char Customer_Name //double Water_Volume //double charge1=0.2 //double charge2=0.5 //double charge3=0.8 //double charge4=1 //Double waterprice //PRINT(Please input Customer ID:\n Name:\n Water Volume:\n //READ Customer_ID,Customer_Name,Water_Volume //COMPUTE waterprice //if (Water Volume<=30) // { // waterprice=Water_Volume*charge1; // } // else if(Water_Volume<=60)&&(Water Volume>=31) // { // waterprice=Water_Volume*charge2; // } // else if(Water_Volume<=99)&&(Water_Volume>=61) // { // waterprice=Water_Volume*charge3; // } // else // { // waterprice=Water_Volume*charge4; // } //PRINT "Customer ID:Customer_ID\nCustomer Name:Customer_Name\nAmount of Water Consumed:Water_Volume\nPayment Due:waterprice\n" //End Program int main(void) { char C_ID[30]; char C_N[30]; double W_V; double charge1=0.2; double charge2=0.5; double charge3=0.8; double charge4=1; double waterprice; printf("Please input:\n Customer ID:\n Name:\n Water Volume:\n"); scanf("%s%s%lf",&C_ID,&C_N,&W_V); if (W_V<=30) { waterprice=W_V*charge1; } else if(W_V<=60&&W_V>=31) { waterprice=W_V*charge2; } else if(W_V<=99&&W_V>=61) { waterprice=W_V*charge3; } else { waterprice=W_V*charge4; } printf("--------------------------------------------------------\nCustomer ID:%s\nCustomer Name:%s\nAmount of Water Consumed:%lf\nPayment Due:$%lf\n",C_ID,C_N,W_V,waterprice); }
run
|
edit
|
history
|
help
0
FloatFahrenheitToCelcius
gets.c
Assignment 3
lol
Estrutura
formatting_input_and_output
project 5 v0.04
PUNTEROS 1
FirstCProg
qsort para struct