Get Writing Help
WhatsApp
    Skip to content
Start Your Order
Uncategorized

Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display…

2 min read

Homework Help Question & Answers

Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display…

Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display the numbers in 3 formats. Then check, whether the larger of the 2 is evenly divisible by the smaller. Detail: Write a complete C program, more complex than the typical “hello world” program. Prompt the user to enter 2 integer numbers that are not negative. After either entry, display that number again. Print the smaller in hexadecimal, in decimal, and in octal format. Include stdio.h, using printf(), with format specifiers %x, %d, and %o of the C printf() statement. Then find out, whether the larger is evenly divisible by the smaller. If so, print a message and print the quotient; but if not, print a message, stating that the 2 are not evenly divisible. Hints: 1.) To prompt the user: printf “Enter unsigned integer nli ” )i, scanf ( “%d”, & n1 ); print “The entered number nl wasi “, ni ), 2.) Output in hex, decimal, and in octal formats: printf( “your number was in hex: %x, in decimal : %d, in octal : %ola”, num , num , num ); 3.) Check if there is a remainder in the integer division of positive values n1 divided by n2: if ( n1 % n2 ) printf( “There is a non-zero remaindern” )
0 0
Add a comment
Academic Writer & Editor
Limited Offer     Get 25% off your first order — use code STUDYLINK25 at checkout    Claim Now