Write a C++ program that asks the user for 50 integer numbers and an integer n. The program will show then the pairs of numbers (a,b) where a=nb.
#include <iostream> using namespace std; int main() { int arr[50], n; cout << "Enter 50 integers: "; for (int i = 0; i < 50; ++i) { cin >> arr[i]; } cout << "Enter a value for n: "; cin >> n; for (int i = 0; i < 50; ++i) { for (int j = 0; j < 50; ++j) { if (arr[i] == n * arr[j]) { cout << "(" << arr[i] << ", " << arr[j] << ")" << endl; } } } return 0; }
Write a C++ program that asks the user for 50 integer numbers and an integer n....
Using loops, write a C# program that asks the user to enter repeatedly an integer number, it stops when the user enters -1, then the program should display how many numbers were entered, their the sum and their average
Exercise 1: Write a C++ program that asks the user to input an integer n followed by n other characters that will be stored in an array. We suppose here that the user will input only lowercase characters between ‘a’ and ‘z’. We also suppose that the user will input different characters. The program will then sort these characters according to an increasing order of their alphabetical order. In this exercise, feel free to use selection sort, insertion sort, or...
Write a C program that asks the user to enter two real numbers. Then your program displays a menu that asks the user to choose what arithmetic operation to be done on those numbers. Depending on the user's entry, the program should display the result to the screen. The sample runs below show what should be done to the numbers entered by the user. Your program should run exactly like shown in the sample runs. make your code run as...
Write a C++ program that asks the user to input a decimal integer (i) and an integer radix from 2 to 16 (r) and outputs the value of iin radix r(base r). (HINT: use repeated division by base r) NOTE: show output screenshot
Exercise Write a program which asks the user to enter an integer n. It will print a diamond shape if n is negative, AA AAAA AAAAAA AAAA AA a triangle otherwise. AA AMA AAAA AAAAA
C++ coding answer 5. Write a program that asks the user for a positive integer value. The program should use a loop to get the sum of all the integers from 1 up to the number entered. For example, if the user enters 50, the loop will find the sum of 1, 2, 3, 4, ... 50. Input Validation: Do not accept a negative starting number.
Design a Java program that asks the user to enter an integer number n and then generates an array of that many random points (x, y) with x- and y-coordinates in the range between 0 and 100. After this the program must ask the user to enter two diagonal points (x_1, y_1) and (x_2, y_2) of a rectangle with sides parallel to the coordinate axis (see the image below, where possible pairs of diagonal points are shown in red color)....
Write a program that prompts the user to enter an integer, n , and then n floating point numbers. As the numbers are read, the program will calculate the average of the negative numbers. In C language.
P.2. Division Write a C program to input an integer n. Then the program asks users to input n integers. Calculate the sum of all non negative integers and the division of this with every negative integer in the sequence. p3 Write a C program to print all 3-digit abc numbers, satisfying: (a+b+c)=(a.b.c). Example: 3-digit 123 number fulfills requirement as (1+2+3)=1.2.3
Write a short program in Java that asks the user for an integer. Then ask the user for a letter. Print out the letter followed by the integer.