What’s the output of the following code?
num = 3
print('my lucky number is ' +
num)
This code does not prints anything.. It throws TypeError Error message is TypeError: can only concatenate str (not "int") to str
What’s the output of the following code? num = 3 print('my lucky number is...
What’s the output generated by the following program fragment? for num in range(1, 25): if num % 5 == 0: print(num) Select one: a. 5 10 15 20 b. 5 10 15 20 25 c. 5 10 15 20 25 d. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
In python What is the output of below code? print(len(“what’s up”))
PYTHON CODE: Fill in the blanks in following line of code to get desired output? print(“My name is ____ and I scored ____ points in my assignment.”(‘Ben’,100)) Desired Output: My name is Ben and I scored 100 points in my assignment.
Python 3 For the code shown below: for num in range(4): print(num) What is the first value printed? 4 1 No correct answer is shown '0'
1. What would be the output of the following lines of code: int num = 2; switch(num){ case 1: cout << "1"; case 2: cout << "2"; case 3: cout << "3"; case 4: cout << "4"; } 2. What would be the output of the following code: char op = '*'; switch(op){ case '+': cout << "Addition"; break; case '-': cout << "Subtraction"; break; case '/': cout << "Division"; break; default: cout << "Invalid"; } 3. What would be...
I have this code for python: num = int(input()) if num == 0: print('No change') else: dol = num // 100 num %= 100 Quarters = num // 25 num %= 25 Dimes = num // 10 num %= 10 Nickels = num // 5 num %= 5 Pennies = num if dol > 0: if dol == 1: print('1 Dollar') if Dollars > 1: print(dol,'Dollars') if Quarters > 0: if Quarters == 1: print('1 Quarter') if Quarters > 1:...
Why this C++ code output is 1 1 num is 3 Can u explain to me? Thank u code: #include using namespace std; void xFunction(int num) { do { if (num % 2!= 0) cout << num << " "; num--; } while (num >=1); cout << endl; } int main() { int num = 1; while (num <= 2) { xFunction(num); ++num; } cout << "num is " << num; return 0; }
What is the output of the following code? int num = 17; //Line 1 double gpa = 3.85; //Line 2 bool done; //Line 3 done = (num == static_cast<int>( (2 * gpa + 9.3))); //Line 4 cout << "The value of done is: "<< done << endl; //Line 5
51. What is the output of the following code snippet? int number = 0; int ptr_num -&number ptr_num 60; number-80 cout < "ptr num << endl b, 60 c. 80 d. the address of number Answer 52. What is the output of the following code snippet? double num-0.0; double* ptr = # num = 15.0; ptr ptr 15.0 cout << num <<"ptr <<endl; a. 15 15 b. 15 30 С. 30 15 d. 30 30 Answer: 53. What is the...
1) Fix the Function #include <iostream> void print Num() { std::cout << number; }; int main() { int number = 35; printNum (number); return 0; (Give two ways to fix this code. Indicate which is preferable and why.) #include <iostream> void double Number (int num) {num = num * 2;} int main() { int num = 35; double Number (num); std::cout << num; // Should print 70 return 0; (Changing the return type of doubleNumber is not a valid solution.)