Rearrange the code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Rearrange the code

Rearrange the code to declare two integer variables: a and b, print to the screen the division equation a/b. If b is equal to 0, throw an exception with a 0 value. throw 0; int a: int b; If (b==0) cout << a/b << endl;

18th May 2017, 3:19 AM
Jorge Luis
17 Answers
+ 4
int a: int b; cin>>a>>b; If (b==0) throw 0; cout<<a/b<< endl;
11th Dec 2017, 2:53 AM
Faisal Kamal
Faisal Kamal - avatar
+ 2
int a: int b;? cout<<a/b<< endl;? If (b==0)? throw 0;?
18th May 2017, 2:16 PM
Jorge Luis
+ 2
answer is int a; int b; cin >> a >> b; if (b == 0) throw 0; cout << a / b << endl;
15th Jan 2020, 9:31 AM
Imanuel Wicaksono
Imanuel Wicaksono - avatar
+ 1
int a: int b; cin>>a>>b; If (b==0) throw 0; cout<<a/b<< endl;
11th Feb 2018, 6:03 AM
vaibhav raj
vaibhav raj - avatar
+ 1
int a;int b; cin>>a>>b; if(b==0) throw 0; cout<<a/b<<endl;
9th Jan 2019, 6:46 AM
Adwit Gautam
Adwit Gautam - avatar
0
............ Have a crack at it
18th May 2017, 3:30 AM
jay
jay - avatar
0
why are you asking?
18th May 2017, 5:55 AM
ifl
ifl - avatar
0
Declare the variables. Check if b is zero and if so, throw an exception. Then print out a/b. Please bear in mind that, if and exception is thrown, the execution halts and passes the control to the parent process. If nothing is thrown, the execution will follow its normal flow.
18th May 2017, 2:35 PM
Álvaro
0
please i need the answer
10th Nov 2017, 11:30 AM
ADESHINA HAMMED OLNIYI
0
+3 int a: int b;? cout<<a/b<< endl;? If (b==0)? throw 0;?
6th May 2018, 10:54 AM
abdiwahab jama said
abdiwahab jama said - avatar
0
Please type in a code to declare two variables of type int and print their sum using the sum variable.
2nd Apr 2019, 9:08 AM
Sbusiso
0
def sayHi(): print ("Hi") sayHi()
7th Oct 2019, 2:37 AM
Mylen Laroa
Mylen Laroa - avatar
0
rearrange the code to declare the variable name, add it to the session, and then print it to the screen. Answer:- Session_start(); $name="Alex"; $_session['name']=$name; echo $_SESSION['name'];
26th May 2020, 4:30 PM
Shailesh Kumar meena
Shailesh Kumar meena - avatar
- 1
thanks all
4th Jun 2020, 6:30 AM
Waled Moumari
Waled Moumari - avatar
- 2
Do you have any guess?
18th May 2017, 5:35 AM
Álvaro
- 2
Please, rearrange the code.
18th May 2017, 1:45 PM
Jorge Luis
- 2
Type in a code to declare variable b and assign a's value to b, and then print their sum to the screen. int a = 15; int b = ; cout << a b << endl;
12th Apr 2018, 9:26 PM
Mohammed Wadi محمد وادي
Mohammed Wadi محمد وادي - avatar