Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalResult is 3.
#include <stdio.h>
int main(void) {
int num1;
int num2;
int finalResult;
num1 = 4;
num2 = 5;
finalResult = (num1 + num2) / 3;
printf("Final result: %d\n", finalResult);
return 0;
}
Total cost.
A drink costs 2 dollars. A taco costs 3 dollars. Given the number of each, compute total cost and assign totalCost with the result. Ex: 4 drinks and 6 tacos yields totalCost of 26.
#include <stdio.h>
int main(void) {
int numDrinks;
int numTacos;
int totalCost;
numDrinks = 4;
numTacos = 6;
totalCost = (numDrinks * 2) + (numTacos * 3);
printf("Total cost: %d\n", totalCost);
return 0;
}
Use left/right arrows to navigate the slideshow or swipe left/right if using a mobile device