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
Marina CMI [18]
2 years ago
14

Given an int as the input, print all the factors of that number, one in each line. For example, if the input is 15 The output wi

ll be 1 3 5\
Computers and Technology
2 answers:
sasho [114]2 years ago
5 0

Answer:

#include<iostream>

using namespace std;

int main()

{

int num, temp = 1;

cout << "Enter the number to determine its factors : " << endl;

cin >> num;

cout << "The factors of " << num << " are : " << endl;

while (temp <= num)

{

if (not(num % temp))

cout << temp << " ";

temp++;

}

cout << endl;

}

Explanation:

trapecia [35]2 years ago
4 0

Answer:

The program to calculate factor can be given as:

Program:

#include <stdio.h> //include header file

int main() //defining main function

{

   int a,i; //defining integer variable

   printf("Enter any number: "); //print message

   scanf("%d",&a); //input value from user end

   for(i=1;i<=a;i++) //loop for calculate factor values

   {

       if(a%i==0) //define condition for factor

       {

           printf("%d\n",i); //print values

       }

   }

   return 0;

}

Output:

Enter any number: 15

1

3

5

15

Explanation:

In the above C language program the header file is include that provide the use of basic function, in the next line the main method is defined, inside this method two integer variable "a and i" is defined in which variable a is used to take value from user end and variable i is used in loop and conditional statement.

  • In the next step, for loop is declare, that start from 1 and end with value of variable a, inside a loop, if block is used that checks (a%i==0), in this if variable i value modeler value equal to 0.  
  • The loop will use the print function that prints variable "i" element in a new line, which is the factor the values.  

You might be interested in
Describe the difference between Global knowledge and personal idea. Why is it important to give credit to others by citing their
sergejj [24]

Global knowledge is like common sense, people know these things, but their may be someone else with the same idea. One person can come up with the idea but their is also another with same so don't give someone to much credit.

7 0
3 years ago
What three characteristics of a function are described in an IPO chart? What is performed at each characteristic?
Blizzard [7]

Answer:

Input

Processing

Output

Explanation:

6 0
3 years ago
What is the name of the virus that appears to be a legitimate program?
timurjin [86]
A virus or malware appearing/pretending to be a legitimate program is called a Trojan. 
3 0
3 years ago
Which tab of the ribbon includes the links group for creating hyperlinks or internal references?
Deffense [45]
The correct answer is D.File
5 0
3 years ago
Read 2 more answers
Help!
aleksandrvk [35]

Answer:

it may be linear gradient.

6 0
1 year ago
Other questions:
  • Computers heat resistant materials breathing systems for fire fighters food-growing technologies improvements in all of the item
    14·1 answer
  • Google Ads was designed to deliver three things to every advertiser: relevance, control, and results. It provides relevance by c
    11·1 answer
  • Write a program that utilizes the concept of conditional execution, takes a string as input, and: prints the sentence "Yes - Spa
    8·1 answer
  • What are two examples of ways an electronic record may be distributed to others?
    15·1 answer
  • A _____ is a number that summarizes an encrypted information. digital certificate hash function message digest hash algorithm
    8·1 answer
  • What might happen if dispatchable threads were removed from the software hierarchy? A. Requests from the mouse would be ignored.
    9·1 answer
  • Richard needs to copy information from another slide presentation that uses a different design template. To ensure that the info
    10·1 answer
  • Brainly app won't let me watch ads anymore. I search my question and there is no skip button to watch an ad it only makes me buy
    7·2 answers
  • What does Amara hope will<br> happen when Dad sits on the sofa?
    8·1 answer
  • Explain approaches of AI​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!