Here are some exercises that will help you get a better grasp of using variables! (Try solving these by hand without a compiler!)
Write one line of code that declares an integer called
cups_of_tea
and assigns to it a value of 5.
What is wrong with the following code? How can you fix it?
#include <stdio.h>
int main(void)
{
("The value of x is %d.\n", x);
printf
int x = 7;
return 0;
}
__basic
apple#3
2023_year
INT
orANGE
total students
982
float_
int float = 34123.4123 * 4;
char student_name = 'John Smith';
int i = 0; i = i + 1;
4 = gpa;
#include <stdio.h>
int main(void)
{
= 16.0;
ounces_of_milk ("You have %lf ounces of milk.\n", ounces_of_milk);
printf
return 0;
}
#include <stdio.h>
int main(void)
{
int apples = 16;
int oranges = 90;
= oranges;
apples = apples;
oranges
("You have %d apples and %d oranges.\n", apples, oranges);
printf
return 0;
}