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
MAXImum [283]
3 years ago
7

Write a program in which given an integer num, return the sum of the multiples of num between 1 and 100. For example, if num is

20, the returned value should be the sum of 20, 40, 60, 80, and 100, which is 300. If num is not positive, return 0.
Computers and Technology
1 answer:
zhuklara [117]3 years ago
5 0

Answer:

#include<iostream>

using namespace std;

int main()

{

  int num=0,sum=0;

  cout<<"Insert Number to find sum of mutiples.";

  cin>>num;

  int temp=num;

  if(num>0){

   sum+=num;

  while(num<100){

        num+=temp;

  sum+=num;

         

  }

  cout<<"Sum of Multiples is ="<<sum<<endl;

  }else{

  return 0;

  }

return 0;

}

Explanation:

This code is written in c++. Written by Saad-Ur-Rehman.

You might be interested in
Create a file named homework_instructions.txt using VI editor and type in it all the submission instructions from page1 of this
KATRIN_1 [288]

Answer:

mkdir homeworks    // make a new directory called homeworks.

touch homework_instructions.txt //create a file called homework_instruction

sudo -i    // login as root user with password.

chmod u+rwx homework_instructions.txt  // allow user access all permissions

chmod go-wx homework_instructions.txt // remove write and execute permissions for group and others if present

chmod go+r homework_instructions.txt  // adds read permission to group and others if absent.

grep POINTS homework_instructions.txt | ls -n

Explanation:

The Linux commands above first create a directory and create and save the homework_instructions.txt file in it. The sudo or su command is used to login as a root user to the system to access administrative privileges.

The user permission is configured to read, write and execute the text file while the group and others are only configured to read the file.

6 0
3 years ago
The scheme function (mult2-diff Ist) should take one argument, a list of numbers, and results in multiplying each number in the
JulijaS [17]

Answer:

The solution code is written in Python.

  1. def mult2_diff(lst):
  2.    num_list = []
  3.    for x in lst:
  4.        num_list.append(x * 2)
  5.    diff = num_list[0]
  6.    for i in range(1, len(num_list)):
  7.        diff = diff - num_list[i]
  8.    
  9.    print(diff)

Explanation:

Firstly, based on the requirement stated in the question, define a function <em>mult2_diff() </em>that takes one argument, <em>lst</em>, which is a list of numbers (Line 1).

This function is expected to multiply each number in the list by two and then followed with computing the difference. To do so, let's try to attempt the first function task, multiplying numbers.  Create a new list, num_list, to hold the multiplied numbers (Line 2). Use a for loop to traverse through each number in the input list, <em>lst</em>, and multiply each of them by two and add it to the <em>num_list </em>(Line 4-5).

To attempt the second function task, create another variable, <em>diff</em>, to hold the value of calculated difference between the numbers in the <em>num_list</em>. Initialize <em>diff </em>with the first number in the <em>num_list</em>. Use a another for-loop to traverse through each number in the num_list starting with second index, <em>1</em>, and calculate the difference between the <em>diff </em>and the current number extracted from the <em>num_list </em>through indexing.

At last print the output of <em>diff</em> (Line 11).

6 0
3 years ago
Sometimes we write similar letters to different people. For example, you might write to your parents to tell them about your cla
OleMash [197]

?

?????????????????????

4 0
3 years ago
Microsoft's ____ is one of the major web-based development environments.
finlep [7]
The answer is ".NET" (had to increase character count to let me post).
4 0
3 years ago
PLEASE PLEASE PLEASE HELP!! WILL GIVE A BRAINLIEST IF UR RIGHT!!
Nataly_w [17]
1. spreadsheet
2. Computers will continue to become smaller in size and become faster

3 0
3 years ago
Other questions:
  • Buildings must be wired to comply with the latest National Electrical Code to ensure that, with adequate maintenance, the instal
    11·1 answer
  • Recording music using a keyboard controller is commonly accomplished using which type of audio file format?
    13·1 answer
  • In evaluating the precedence rules used by Python, what statement is accurate? a. Addition and subtraction are evaluated after a
    8·2 answers
  • Complete the following table.
    6·1 answer
  • Consider the following program segment: //include statement(s) //using namespace statement int main() { //variable declaration /
    9·1 answer
  • In an information systems framework, ________ is the bridge between the computer side on the left and the human side on the righ
    14·1 answer
  • Is it important for a writer to include voice and point of view in writing because...<br> Plz help
    10·1 answer
  • Write a program that inputs a five-digit integer, spearates the integer into its digits and prints them seperated by three space
    6·1 answer
  • Explain the bad effect and good effect of mobile phone and internet.<br>​
    15·2 answers
  • Blockquote
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!