1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
julsineya [31]
3 years ago
8

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
Computers and Technology
1 answer:
AVprozaik [17]3 years ago
6 0

Answer:

See Explanation

Explanation:

Your program is correct and it follows the correct sequence; however, the reason you keep getting integer result is because the question requires that you declare both variables as integer.

The only modification required in your program is to change change #include to #include <stdio.h> for the program to be free of error.

You might be interested in
What is the internet?
Inessa [10]
 this is the definition:<span>a global computer network providing a variety of information and communication facilities, consisting of interconnected networks using standardized communication protocols.</span>
3 0
3 years ago
Read 2 more answers
Privacy, anonymity, and freedom of expression are all interrelated.
Andre45 [30]

Answer:

Criminals (terrorists).

Explanation:

6 0
3 years ago
Select the correct answer.
Triss [41]

Answer:

b or d

Explanation:

3 0
3 years ago
What are foundations of any game systems that control what the players can or cannot do in the game, as well as the penalties, r
san4es73 [151]

Answer:

A. Rules

Explanation:

Rules can determine what can be done and what cannot be done... giving it restrictions, or RULES in a video game among-st a player

4 0
3 years ago
How to write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator).
fomenos

Answer:

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

if num1 < 1 or num2<1:

     print("Input must be greater than 1")

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))

Explanation

The next two lines prompts the user for two numbers

<em>num1 = int(input("Numerator: "))</em>

<em>num2 = int(input("Denominator: "))</em>

The following if statement checks if one or both of the inputs is not positive

<em>if num1 < 1 or num2<1:</em>

<em>      print("Input must be greater than 1")-> If yes, the print statement is executed</em>

If otherwise, the quotient and remainder is printed

<em>else:</em>

<em>      print("Quotient: "+str(num1//num2))</em>

<em>      print("Remainder: "+str(num1%num2))</em>

<em />

3 0
3 years ago
Other questions:
  • You can click a web page title on the _____ list to return to that page.
    10·1 answer
  • 17. When an industrial electrical circuit requires a 220 VAC single phase power supply, the electric power supply circuit is nor
    7·1 answer
  • Write 3 things that can't be done without technology. write your opinion?
    14·2 answers
  • IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in
    7·1 answer
  • Please help thank you !!!
    7·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    13·1 answer
  • PLZZZZZZZZZZZZZZZ HELP ME OUT!!!!! I SICK AND TIRED OF PEOPLE SKIPING MY QUESTION WHICH IS DUE TODAY PLZ ANSWER ALL OFIT!!!!
    10·1 answer
  • Write steps for converting decimal to binary numbers?
    13·1 answer
  • What will be the output, if any, when the user clicks the right mouse button?
    5·1 answer
  • When conducting memory and recall tests, some people make an effort to normalize memories by not reporting extreme cases. this l
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!