subject

In this lab you are asked to declare two variables of type integer: userNum and x. The user should input should be stored using scanf statements. Then you are asked to divide the value for userNum by x three times(three different operations). Each time you do the division, assign the value to userNum overwriting the previous value and print it out using a print statement. Do this three times. In this case there is only one new line print statement at the end. #include
int main(void) {
int x;
int userNum;
scanf("%d %d" , &userNum, &x);
userNum = (double)userNum / x;
printf("%d " , userNum);
userNum = (double)userNum / x;
printf("%d " , userNum);
userNum = (double)userNum / (double)x;
printf("%lf\n" , (double)userNum);
return 0;
}
my input is 100 2
my output is 50 25 12.000
8 months ago

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:00
Which factor is the most important when choosing a website host? whether customers will make secure transactions the number of email accounts provided the purpose of the website the quality of the host control panel
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Which of the following is not a way in which trees benefit the environment? a. they remove a significant amount of carbon dioxide from the atmosphere. b. they remove a significant amount of oxygen from the atmosphere. c. their roots hold soil in place, reducing rates of erosion. d. they remove ozone and particulates from the atmosphere. select the best answer from the choices provided a b c d
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
Match the following. 1. formatting that is applied when cell data meets certain criteria 2. borders with formats not found on the border tool 3. a shortcut bar that contains tools for commonly used formats 4. formats that can be applied to numbers conditional formatting custom borders format bar number formats
Answers: 3
You know the right answer?
In this lab you are asked to declare two variables of type integer: userNum and x. The user should i...
Questions
question
Mathematics, 26.08.2020 07:01
question
English, 26.08.2020 07:01
question
Computers and Technology, 26.08.2020 07:01
Questions on the website: 13722363