Question: 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

 Using loops, selection and input and output in C Write a

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!