Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
|
Privacy
Assignment 5 v2
#include <stdio.h> int main (void) { double gallon=21.0; double gallonPrice; char name[20]; scanf("%s", &name); if (gallon <= 30 ) { gallonPrice=0.20*gallon; printf("The price of the gallon is %lf\n", gallonPrice); } else if(gallon <= 60) { gallonPrice=0.50*gallon; printf("The price of the gallon is %lf\n", gallonPrice); } else if(gallon <= 99) { gallonPrice=0.80*gallon; printf("The price of the gallon is %lf\n", gallonPrice); } else if(gallon >= 100) { gallonPrice=0.50*gallon; printf("The price of the gallon is %lf\n", gallonPrice); } printf("Dear %s,\n", name); printf("The price in total is %lf\n", gallonPrice); printf("The amount of gallons you have consumed is %lf\n", gallon); printf("customer ID is 68461\n"); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Project 3 Part 1 v1.75
Project 3 Part 1 v1.3
SOLUCIONES_TRABAJO_05
A_141128_MatricesProducto
int_A_1a.c
150116_MatrizOrdenada
Hello world.c
Spring 2017 Project 2 v1.3
linear hybrid cellular automaton utilizing rules 90 and 150 with period of (2^64)-1 for generating high quality random bits is reversible
Multiple if statement v0.8
Please log in to post a comment.