What will be the value of discountRate after the following statements are executed?
double discountRate = 0.0
int purchase = 100;
if (purchase > 1000)
discountRate = 0.05;
else if (purchase > 750)
discountRate = 0.03;
else if (purchase > 500)
discountRate = 0.01;
What will be the value of discountRate after the following statements are executed? double discountRate =...
Please answer and explain thank you. Question 1 What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x); Group of answer choices 45678.259 0,045,678.26 45,678.26 45,678.3 Question 2 What will be printed when the following code is executed? double x = 45678.259; String output = String.format("%,.1f", x); System.out.println(output); Group of answer choices 45678.259 45,678.259 45,678.26 45,678.3 Question 3 What will be the value of ans after the following code has been executed? int ans=0;...
QUESTION 1 What will be displayed as a result of executing the following code? int x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points QUESTION 2 What will be the displayed when the following code...
What will the value of the string s1 after the following statements have been executed? strcpy(s1, "computer"); strcpy(s2, "science"); if(strcmp(s1, s2) < 0){ strcat(s1, s2); } else{ strcat(s2, s1); } s1[strlen(s1) - 6] = '\0'; I know the answer is "Computers" but why? Can someone explain to me how to approach this problem?
After the following declarations and statements are executed: int i, j, k ; boolean c; float x, y, z; int[ ] num = {4, 1, 2, 3, 8}; i = 3; j = 5; x = 4.3; y = 58.209; c = !(i > j) ; what is the value of c
What is the value of y after the following code is executed? int x = 20, y = 30; do { int z; z = 3 * ( y
Question 19 What is the value of test_val after the following code is executed? a = 12 test_val = 6 if a *2 test_val: a = a + 7 else: test_val = 2 * a test_val = a + 1 07 13 24 25
What will be the value of ans after the following code has been executed? int x = 90, y = 55, ans = 10; if ( x == y); a. 10 b. No value, no syntax error c. 145 d. ans *= 2;
Programming logic C# visual studio What are the values of the double variable x after each of the following statements is executed? x = Math.Abs(7.5); x = Math.Floor(7.5); x = Math.Abs(0.0); x = Math.Ceiling(0.0); x = Math.Abs(-6.4); x = Math.Ceiling(-6.4); x = Math.Ceiling(-Math.Abs(-8 + Math.Floor(-5.5)));
5. (7 pts) What wil display on the output screen after following program is executed? includeciostream using namespace std int b 40 int A function(int a) int main (void) int c 7, b 15 cout<cA function (e) <cendla return 6 int A function (int a) int i cout<<b<<endl; if (a>-0) else return i i-ai i--ai Ans5 6. (7 pts) Show what will appear on the output screen after the following program is executed tincludeciostream> using namespace std; void A function...
What is the output, to the console, once the following code has executed? int collatz(int value) { if(value % 2 ==0) return value /2; else return value * 3+1; } int main() { int currentValue=1; int i; for (i=0; i<5; i++) { printf("%d\n", currentValue); currentValue= collatz(currentValue); } return 0; }