Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using loops, selection and input and output in C Write a C program that prompts the user to enter two positive integers. Your program should

image text in transcribed

Using loops, selection and input and output in C Write a C program that prompts the user to enter two positive integers. Your program should then display the greatest common divisor of the two integers. The program should check if the user enters any negative numbers and should print an error message if so The input continues until the user enters 0 for the first number Possible sample output: Please enter a positive integer. Enter 0 to quit: -4 Error! This is not a positive integer Please try again Please enter a positive integer. Enter 0 to quit: 24 Please enter a second positive integer: -4 Error! This is not a positive integer Please enter a second positive integer: 15 The gcd of 24 and 15 is 3 Please enter a positive integer. Enter 0 to quit: 2.3 Please enter a second positive integer: 17 The gcd of 23 and 17 is 1 Please enter a positive integer. Enter 0 to quit: 0 Have a nice day

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago