Write a C program that will do the following: 1.Declare four integers variables.
ID: 3747015 • Letter: W
Question
Write a C program that will do the following:
1.Declare four integers variables. intVar1, intVar2, intVar3,and intVar4.
2. Initialize intVar1 to the value 4; initialize intVar2to the value 5.
3. Declare four more integer variables. exp1, exp2,exp3, and exp4.
4. Declare a character variable charVar.
5. Assign the value of each expression below to variables exp1and exp2 respectively:
exp1= intVar1 + ((5 * intVar2) / (3 * intVar1));
exp2 = intVar1 + (5 * (intVar2 / 3)) * intVar1;
6. Using the fprintf()function, print to standard output the values of the variables (your output should look like the following):
intVar1= 4 and intVar2 = 5
Expression values are: exp1 = 6 exp2 = 24
Explanation / Answer
#include int main() { //1.Declare four integers variables. intVar1, intVar2, intVar3,and intVar4. int intVar1, intVar2, intVar3, intVar4; //2. Initialize intVar1 to the value 4; initialize intVar2 to the value 5. intVar1 = 4; intVar2 = 5; //3. Declare four more integer variables. exp1, exp2,exp3, and exp4. int exp1, exp2,exp3, exp4; //4. Declare a character variable charVar. char charVar; //5. Assign the value of each expression below to variables exp1and exp2 respectively: exp1 = intVar1 + ((5 * intVar2) / (3 * intVar1)); exp2 = intVar1 + (5 * (intVar2 / 3)) * intVar1; //6. Using the fprintf()function, print to standard output the values of the variables (your output should look like the following): //intVar1= 4 and intVar2 = 5 //Expression values are: exp1 = 6 exp2 = 24 fprintf(stdout, "intVar1 = %d and intVar2 = %d ", intVar1, intVar2); fprintf(stdout, "exp1 = %d exp2 = %d ", exp1, exp2); return 0; }Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.