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
NeTakaya
3 years ago
12

Developed by Frank Vahid. Write a program using integers usernum and x as input, and output usernum divided by x four times. For

example, if the input is: 2000 2 where user_num = 2000 and x = 2, then the output must be: 1000 500 250 125 Note: all the values must be printed on the same line. Also, recall that in Python 3, integer division discards fractions. Ex: 6 // 4 is 1 (the 0.5 is discarded).
Computers and Technology
1 answer:
OleMash [197]3 years ago
7 0

Answer:

Explanation:

Let's do this in Python. We will loop through 4 times, each of the loop would compute the dividend, store it as string in a result variable and finally print the result on the same line:

def divide_4_times(user_num, x):

    result = ''

    for i in range(4):

         user_num /= x

         result += (' ' + str(user_num))

   print(result)

You might be interested in
Question 2 (2 points)
swat32

I beleive all of the above for question one

4 0
3 years ago
What happens when you print a document with red, green, and blue underline?
Olegator [25]
They will not show up on pages

8 0
3 years ago
Read 2 more answers
Implement the function fileSum. fileSum is passed in a name of a file. This function should open the file, sum all of the intege
maria [59]

Answer:

/*C++ program that prompts user to enter the name of input file(input.txt in this example) and print the sum of the values in the file to console. If file dosnot exist, then close the program */

//header files

#include <fstream>

#include<string>

#include <iostream>

#include <cstdlib> //needed for exit function

using namespace std;

//function prototype

int fileSum(string filename);

int main()

{

string filename;

cout << "Enter the name of the input file: ";

cin >> filename;

cout << "Sum: " << fileSum(filename) << endl;

system("pause");

return 0;

}

/*The function fileSum that takes the string filename and

count the sum of the values and returns the sum of the values*/

int fileSum(string filename)

{

//Create a ifstream object

ifstream fin;

//Open a file

fin.open(filename);

//Initialize sum to zero

int sum=0;

//Check if file exist

if(!fin)

{

cout<<"File does not exist ."<<endl;

system("pause");

exit(1);

}

else

{

int value;

//read file until end of file exist

while(fin>>value)

{

sum+=value;

}

}

return sum;

}//end of the fileSum

Explanation:

This is a C++ program that prompts user to enter the name of input file(input.txt in this example) and print the sum of the values in the file to console. If file dosnot exist, then close the program.

Check attachment for sample output screenshot.

5 0
3 years ago
A computer never gets tired or bored while working for a long time .. ​
Angelina_Jolie [31]

Answer :Computers never get tired or bored because of doing the same task continuously. They work in the same manner all the time. A computer can store large amount of information in its memory.

Explanation: it is quality which makes the user to be dependent on computer. As we all know, computer systems do repetitive tasks without any boredom, tiredness, or fatigue.

5 0
3 years ago
Which are examples of hardware? Select 3 options.
umka21 [38]

Answer: OS(Operating System), CPU, And The Program That you use to view email

6 0
3 years ago
Read 2 more answers
Other questions:
  • Cyberlaw consists of: a. only state statutes. b. only federal statutes. c. traditional legal principles that have changed becaus
    6·1 answer
  • Each processor core on a multi core processor generally runs faster than a single core processor
    14·2 answers
  • Which one is correct
    8·1 answer
  • Which routing protocol does an exterior router use to collect data to build its routing tables?
    8·1 answer
  • In this lab, you will build a system for package delivery services that provides different shipping options with specific price.
    6·1 answer
  • How many bits would be needed to count all of the students in class today?There are 25 in class
    15·2 answers
  • Which types of file formats are the best choice for files that may need to be edited later?
    14·1 answer
  • Which memory will be suitable (a) to Run a software (b) to store a software permanently ?
    9·1 answer
  • What does input allow a computer to do
    14·1 answer
  • How do I fix when it hits the second session it skips scanf.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!