Question

In: Computer Science

1) type a complete, working, C++ program that accepts two integer values from the variable num3,...

1) type a complete, working, C++ program that accepts two integer values from the variable num3, and store num1 raised to the power num2 into the variable num4. Then output the values of the four variables each on a separate line, formatted and with an appropriate message for each.keyboard into the variables num1 and num2, include prompts, store the square root of their sum into the

program :

Solutions

Expert Solution

CPP program :

//header files
#include <iostream>
#include<cmath>
using namespace std;
//main() method
int main()
{
//declaring variables
int num1=0,num2=0;
float num3=0,num4=0;
//asking user num1
cout<<"Enter num1 : ";
cin>>num1;//reading num1
//asking user num2
cout<<"Enter num2 : ";
cin>>num2;//reading num2
//calculate square root of their sum
num3=sqrt(num1+num2);
//calculate and num1 raised to power of num3
num4=pow(num1,num2);
//print numbers
cout<<"num1 : "<<num1<<endl;//print num1
cout<<"num2 : "<<num2<<endl;//print num2
cout<<"The square root of their sum : "<<num3<<endl;
cout<<"num1 raised to the power num2 : "<<num4<<endl;
return 0;
}
=============================================

Output :


Related Solutions

Initialize and Print an Array Write a program that accepts two integer values, called "arraySize" and...
Initialize and Print an Array Write a program that accepts two integer values, called "arraySize" and "multiplier", as user input. Create an array of integers with arraySize elements. Set each array element to the value i*multiplier, where i is the element's index. Next create two functions, called PrintForward() and PrintBackward(), that each accept two parameters: (a) the array to print, (b) the size of the array. The PrintForward() function should print each integer in the array, beginning with index 0....
Write a C++ program that accepts a positive integer number from the keyboard . The purpose...
Write a C++ program that accepts a positive integer number from the keyboard . The purpose of the program is to find and the display all the square pair numbers between 1 and that number. The user should be able to repeat the process until he/she enters n or N in order to terminate the process and the program. Square numbers are certain pairs of numbers when added together gives a square number and when subtracted also gives a square...
Write a program that asks the user to type in two integer values. Test these two...
Write a program that asks the user to type in two integer values. Test these two numbers to determine whether the first is evenly divisible by the second and then display the appropriate message to the terminal. Objective C
In C++, Write a program that accepts exactly ten (10) integer numbers from the user. When...
In C++, Write a program that accepts exactly ten (10) integer numbers from the user. When the user is done inputting these numbers, the program prints back: (i) the sum of the 10 numbers, (ii) the minimum value from the 10 numbers, and (iii) the maximum value from the 10 numbers.
• Write a C++ program that asks the user to input two integer values, then calls...
• Write a C++ program that asks the user to input two integer values, then calls a void function "swap" to swap the values for the first and second variable. • As we mentioned before, in order to swap the valors of two variables, one can use the following: temp= variable1; variable1 = variable2; variable2 = temp; • Display the two variables before you call swap and after you call that function. Comment in code would be greatly appreciated to...
In C ++, Design and implement a program that reads from the user four integer values...
In C ++, Design and implement a program that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:    95, 80, 100, 70 Highest grade: 100 Lowest grade:   70 Average grade: 86.25
Write a C++ program that accepts a single integer value entered by user. If the value...
Write a C++ program that accepts a single integer value entered by user. If the value entered is less than one the program prints nothing. If the user enters a positive integer n. The program prints n x n box drawn with * characters. If the user enters 1 , for example the program prints *. If the user enter a 2, it prints ** ** that is , a 2x2 box of * symbols.
Given the following C function prototype which accepts an integer argument, complete the implementation of the...
Given the following C function prototype which accepts an integer argument, complete the implementation of the function in C language to return the number of 1’s in the binary representation of the number passed. For example if the number is (011100011 ) then the function should return 5 as the number of 1s. Please remember that an integer is 32 bits long. USE the following function int countOnes(int number) Write a full c program that has the header required and...
Question 2. Write a MARIE program that accepts an integer from the user, and if it...
Question 2. Write a MARIE program that accepts an integer from the user, and if it is a prime number the program will output 1, otherwise, the program will output 0. Examples: If the user input is 17, the output would be 1 If the user input is 2, the output would be 1 If the user input is 15, the output would be 0 If the user input is -2, the output would be 0 You should write and...
Write a C program that allows: Three integer values to be entered (read) from the keyboard,...
Write a C program that allows: Three integer values to be entered (read) from the keyboard, Display the sum of the three values on the computer screen as follows: The integers that you have entered are: a b c The sum of a , b & c is ______ Thank you! C Code: Output screen:
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT