Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started