Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
assignment 3 celina
//gcc 5.4.0 #include <stdio.h> int main(void) { printf("Hello, world!\n"); int banana= 1; int bananaQuantity= 1; //part 1 printf("banana=%d\n",banana); printf("bananaQuantity=%d\n", bananaQuantity); scanf("banana=%d\n", banana); scanf("bananaQuantity=%d\n", bananaQuantity); double solutionBanana= (banana*bananaQuantity); printf("solutionBanana: %f\n", solutionBanana); int yogurtPLU= 3; int yogurtQuantity= 2; printf("yogurtPLU=%d\n", yogurtPLU); printf("yogurtQuantity=%d\n", yogurtQuantity); scanf("yogurtPLU=%d\n",yogurtPLU); scanf("yogurtQuantity=%d\n", yogurtQuantity); double solutionYogurt= (yogurtPLU*yogurtQuantity); printf("solutionYogurt: %f\n", solutionYogurt); double tax= ((solutionYogurt+solutionBanana)*0.05); printf("tax: %f\n", tax); double totalPrice= (solutionYogurt+solutionBanana+tax); printf("total price with tax: %f\n", totalPrice); char cardholderName[50]= "Celina Rashid"; printf("cardholder name: %s\n", cardholderName); char cardNumber[40]= "2468345678927863"; printf("card number: %s\n", cardNumber); char expirationDate[30]= "07/22"; printf("expiration date: %s\n", expirationDate); //part 2 int bananaQuantityNew =2; double solutionbananaNew= (banana*bananaQuantityNew); printf("solution banana new: %f\n", solutionbananaNew); double taxNew= ((solutionYogurt+solutionbananaNew)*0.05); printf("tax new: %f\n", taxNew); double totalpriceNew= (solutionYogurt+solutionbananaNew+taxNew); printf("new total price: %f\n", totalpriceNew); char thankyou[20]= "Celina Rashid"; printf("thank you: %s\n", thankyou); double numberofItems= (bananaQuantityNew+yogurtQuantity); printf("number of items: %f\n", numberofItems); return 0; }
run
|
edit
|
history
|
help
0
Primes in binary
stringify
Spring 2017 Project 2 v.02
Bitwise Operations
141124_PI
Lab 9 v0.965
Lab 7 blackjack v1.0
Finite State Machine Program Example (ECE 2534)
incrementing values in an array
dynamic memory allocation.c