Problem 16:
#include <iostream>
#include<math.h>
using namespace std;
int main( )
{
float x;
cout << "Input the value of x : ";
cin >> x;
float y = (x+sqrt(x*x-(2/x)))/(2*x);
cout << "Value of y : " << y << endl;
return 0;
}
Problem 18:
#include <iostream>
#include<math.h>
using namespace std;
int main( )
{
int rows;
while(true)
{
cout << "Input the number of rows inbetween 3
and 42 : ";
cin >> rows;
if(rows>=3 && rows<=42)
break;
else
continue;
}
for(int i=rows;i>=1;i--)
{
for(int j=0;j<i;j++)
{
if(j==0 || j==i-1)
cout <<
"*";
else
cout << "
";
}
cout << "\n";
}
return 0;
}
Problem 16. Write a program to prompt the user for a floating point number x and...
I have to write a program in java which uses while loops. 1.prompt the user to input two intergers: firstnum ans second numnumber. (first number must be smaller that the second number). 2. Output all the even numbers between first number and second number inclusive. 3. Output the sum of all the even number between first number and second number inclusive. 4 Output all the odd numbers between first number and second number inclusive. 5. Output the sum of all...
Assignment Input from the user 9, 64-bit, floating-point values as a 3x3, row-major, multi-dimensional array. This will be the 3x3 matrix. Then, input 3, 64-bit, floating-point values. This will be a single-dimensional array and is the vector. Your program will simply ask the user to enter matrix values. Remember, there are 9 of these, but they need to be stored into a 3x3 multi-dimensional array (row-major). Then, your program will ask for the vector values, which will be stored into...
1. Prompt the user for one of the arithmetic operators ('op'): +, -, *,/, or ** 2. Prompt the user for two input integers ('a' and'b') 3. The input numbers can be positive or negative 4. Perform the arithmetic operation using the two input numbers 5. The first entered number ('a') is the left side, the second ('b') the right side of the operation For exponentiation, the first number is the base, the second the exponent Print (display) the following...
Write a PYTHON program that reads a file (prompt user for the input file name) containing two columns of floating-point numbers (Use split). Print the average of each column. Use the following data forthe input file: 1 0.5 2 0.5 3 0.5 4 0.5 The output should be: The averages are 2.50 and 0.5. a) Your code with comments b) A screenshot of the execution Version 3.7.2
USING C# 1. Write a program that takes outputs a string, an integer and a floating-point number separated by commas. Sample output: Bob Marley, 20, 5.2 2. 2. Write a program that asks the user for a string of letters of any size (no spaces), and finally a special character (values 33 to 47 in the Ascii table, or ‘!’ to ‘/’). Generate a random number of any size, integer or floating point, and combine those three pieces of information...
Q3. Write a MATLAB program that prompt the user to enter number of studentsN) Then, gave each students their grades(G1, G2,.GN), find the average grade (AV), the biggest grade (M) and the rank of the biggest grade(R). INPUT: 5,50,60,70,80,90), OUTPUT(70,90,5) Q3. Write a MATLAB program that prompt the user to enter number of studentsN) Then, gave each students their grades(G1, G2,.GN), find the average grade (AV), the biggest grade (M) and the rank of the biggest grade(R). INPUT: 5,50,60,70,80,90), OUTPUT(70,90,5)
C++ Write a complete program that will prompt the user for a digit in the range 5 to 15. Using that digit to determin scale display the graphic shown below. Your program must use a nested loop. You may not use the string class SAMPLE RUN: Input an integer in the range 5 to 20: 100 Incorrect. The number is out of range. Input an integer in the range 5 to 20: 10 * ** *** **** ***** ****** *******...
Using java Sample Outputs Write a program which asks the user for an integer and then prints the following patterns based on that integer. Input Validation For Pattern 1, the input must be a value between 1 and 999 For Pattern 2, the input must be a value between 1 and 26. Requirements: For Pattern 1: must be able to work with up to three digit numbers. You will want to use printf to get the spacing correct. For Pattern...
C++ Suppose a user is prompted to enter four floating point number values. Write a C++ program that outputs the number of input values, the number of negative values, and the number of even values.
Write one complete C program that asks the user for a floating point number and displays the absolute value of the number with two decimals of accuracy. You are not allowed to use the abs or fabs functions.