Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new Simplify Radical C++ program and name it: Simplify Radical 2 Here you will simplify radical equations with coefficients that are greater than

Create a new Simplify Radical C++ program and name it: Simplify Radical 2

Here you will simplify radical equations with coefficients that are greater than 1.

output:

Enter the coefficient:

3

Please enter a number to simplify: 18 9 SqRt [2]

code:

#include

using namespace std;

int checkprime(int n, int c){ int flag = 0; int m = n / 2; for(int i = 2; i <= m; i++){ if(n % i == 0){ flag = c; break; } }

if (flag==0){ return 1; } return 0; }

int main(){ char ans = 'y'; int n = 0; int c = 0; bool b = false; while(ans == 'y'){ cout << "enter the coefficient" << endl; cin >> c; cout << "Please enter a number to simplify:" << endl; cin >> n; checkprime(n, c); if(checkprime(n, c)){ cout << "SqRt[" << n << "]" << endl; }else{ for(int i = c; i <= n/2; i++){ if (i * i == n){ cout << i << endl; break; } } } cout << "Do you have another number to simplify? y for yes or n for no" << endl; cin >> ans; }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

What factors differentiate a good market from a poor market?

Answered: 1 week ago

Question

What is digital literacy? Why is it necessary?

Answered: 1 week ago