Answer:
1.) 25 ; 15 ; 15
2.) 50 ; 15 ; 50
Explanation:
In the first function written :
The variable val was initially decaled or assigned a value of 25 and that was what was printed first.
However, after the example function was written, the val variable was finally assiagned a value of 15 within the function. However, it was also declared that the global variable takes uonthe val value. Hence, the val variable initially assigned a value, of 25 changes to 15 globally.
For the second code :
From the top:
Val was assigned a value of 50 ;
Hence,
print(val) gives an output of 50
Within the function definition which prints the value of val that is assigned a value of 25 within the function.
Since tbe global variable isnt reset.
Printing Val again outputs 50;since ito is outside the function.
Answer:
Explanation:
The Rectangle class was not provided in this question but after a quick online search I was able to find the class code. Due to this I was able to create a test code in the main Method of my program to create a Rectangle object and call it's display() method. The Test code and the output can be seen in the attached image below. While the code below is simply the Main Test Program as requested.
class Brainly {
public static void main(String[] args) {
Rectangle rectangle = new Rectangle(20, 8);
rectangle.display();
}
}
23 bits would leave room for 512 node numbers.
Answer:
// here is code in c++.
// include header
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables to read input
int userNum,x;
cout<<"enter the value of userNum and x :";
// read the input from user
cin>>userNum>>x;
// divide the userNum with x 4 times
for(int a=0;a<4;a++)
{
userNum=userNum/x;
cout<<userNum<<" ";
}
cout<<endl;
return 0;
}
Explanation:
Declare two variables "userNum" and "x". Read the value of these. Run a for loop 4 time and divide the "userNum" with "x" and print the value of "userNum".
<u>Output:</u>
enter the value of userNum and x :2000 2
1000 500 250 125