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 06:30
Selective incapacitation is a strategy to reduce prison population
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
Report all segments of identity by descent longer than 20 polymorphisms between pairs of individuals in the following cohort of 15 individuals across 49 polymorphisms: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 numeric input 2 points possible (graded) you have 2 attempts to complete the assignment below. for example if the sequence is "bcd", which occurs in "abcdef" , the starting point would be 2 (b), and the finishing point would be 4(d). individuals 7,10 between positions
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
What are some settings you can control when formatting columns?
Answers: 1
question
Computers and Technology, 24.06.2019 20:00
Avirus enters a computer or network as code embedded in other software directly from another computer
Answers: 1
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, 02.12.2020 22:40
question
Mathematics, 02.12.2020 22:40
question
Mathematics, 02.12.2020 22:40
Questions on the website: 13722367