1. Request a 3-digit integer from the console. Use division and modulo operations to extract each digit in reverse order. For each digit, determine if it is a factor of the original integer. Example Output (input in bold italics)
Enter a 3-digit integer: 543
Is 3 a factor of 543? 1
Is 4 a factor of 543? 0
Is 5 a factor of 543? 0
The code for the above program is given below, I have commented in line for the explanation.
Code;-
#include<iostream>
using namespace std;
int main() {
int n;
cout<<"Enter the 3-digit integer: ";
cin>>n;// input the number
int temp=n; // store the number in temp for further use
// as we need only 3 digit number therefore loop only 3 times
for(int i=0;i<3;i++)
{
int r=n%10;// this will find remainder when divided by 10
cout<<"Is "<<r<<" a factor of
"<<temp<<"?";
if(temp%r==0)
cout<<" 1"<<endl;
else
cout<<" 0"<<endl;
n=(n-r)/10;// this will reduce the digit by one like 543 ->
54
}
}
Output:-

Hope it clears your doubt and you like it :)
1. Request a 3-digit integer from the console. Use division and modulo operations to extract each...
Request an integer n from the console. Write a function that accepts n as input and outputs the multiplication table of n from 1 to n to the console. Example Output (input in bold italics) Enter an integer: 9 1 * 9 = 9 2 * 9 = 18 3 * 9 = 27 4 * 9 = 36 5 * 9 = 45 6 * 9 = 54 7 * 9 = 63 8 * 9 = 72 9...
please use c++ language 1. Request three different integers from the console. a) Write a swap function that swaps two integer values. b) Write a sort function which accepts three integers as input then sorts them from largest to smallest using the swap function. c) Output the integers before and after sorting. Example 1 Output (input in bold italics) Enter three different integers: 3 2 4 3 2 4 4 3 2 Example 2 Output (input in bold italics) Enter...
1. (Sum the digits in an integer) Write a method that computes the sum of the digits in an integer. Use the following method header: public static int sumDigits(long n) For example, sumDigits (234) returns 9 (2 + 3 + 4). (Hint: Use the % operator to extract digits, and the / operator to remove the extracted digit. For instance, to extract 4 from 234, use 234 % 10(= 4). To remove 4 from 234, use 234 / 10(= 23)....
Task 4: Integer and Floating Point Division Open Division.java and write code to solve the following problem: 1. prompts for and reads in an integer (on the same line) 2. Outputs: i) the value of the number divided by 100 as a floating point value ii) the remainder when the number is divided by 100 iii) the number of times 100 divides the integer iv) outputs the digits of the integer in reverse order; i.e., each digit must be extracted...
Nested loops
c++ nested loops
1. Request an odd integer value between 10 and 20. Input should be validated until correct. Use a nested loop to output the below image. Example Output (input in bold italics) Enter an odd integer between 10 and 20: 11 Χ Χ Χ Χ Χ Χ Χ Χ Χ Χ Χ XX - - - - - - - X X X - X - - - - X - - X - - X...
RAPTOR PROGRAMMING Write a program which will receive two integer values as input. Then prompt the user to choose one of the following operations and produce an output with the selected operation. 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Modulo Division Example output with response: Please enter an input: 2 Please enter another input: 3 Please choose from the follow: 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Modulo Division Output: 2 % 3 is 2.
C++ 3. Random modification of all elements in an integer array. a) Initialize an integer array of capacity 5. b) Implement an array output function. c) Output the array to console. d) Implement an offset function that accepts an integer array as input and randomly modifies each element by +/- 5. e) Use the offset function to update the array. f) Output the modified array. Example Output (input in bold) Original: 5 1 4 9 2 Offset: 7 -2 6...
C++
3. Write a program that recursively calculates n factorial (n!) a) Main should handle all input and output b) Create a function that accepts a number n and returns n factorial c) Demonstrate the function with sample input from console. n! n * n-1 * n-2 * n-3, for all n > 0 For example, 3!-3 21-6 using a recursive process to do so. Example output (input in bold italics) Enter a number: 5 5120
Function Name: sepDigits Inputs: 1. (double) A three-digit integer Outputs: 1. (double) The hundreds-place digit of the input 2. (double) The tens-place digit of the input 3. (double) The ones-place digit of the input Function Description: This function will take in a three-digit integer (integer between 100 and 999 , inclusive) and should return each digit as a separate number. For example, if the input is 472 , the first output would be 4 , the second would be 7...
Write an application in java that reads in a five-digit integer and determines whether it is a palindrome. If the number is not five digits long, display an error message and allow the user to enter a new value. Tips: 1. Determine the number of digits in the value input by the user , i.e. prompt the user to enter the number of digits of the number. Use a while loop to determine whether the user input contains the proper...