Final
This commit is contained in:
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"stdio.h": "c"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// COS135-HW3
|
||||
// Nicholas Pease
|
||||
// 8 FEB 2023
|
||||
// All Work Below Is My Own
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
float prices[] = {21.45,10.00,14.90,33.50};
|
||||
float totalPrice;
|
||||
char storeName[18] = "Aubuchon Hardware\0";
|
||||
printf("Welcome to %s\n",storeName);
|
||||
printf("------------------------------\n");
|
||||
for (int i=0; i < 4; i++) {
|
||||
// Item, item num (i), tab, '$', float with 2 digit precision, tab, 'x2', tab, '$', float with .2 precision, newline
|
||||
printf("Item %i\t$%.2f\tx2\t$%.2f\n",i+1,prices[i],prices[i]*2);
|
||||
totalPrice = totalPrice + 2*prices[i];
|
||||
}
|
||||
printf("------------------------------\n");
|
||||
printf("\nItem total: $%.2f\n",totalPrice);
|
||||
float GST = totalPrice * 0.1;
|
||||
printf("\nGST:\t$%.2f\n",GST);
|
||||
printf("Total:\t$%.2f\n",totalPrice+GST);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user