Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can i get some help on the following requirements in C. Modify the program Figure 2.6 (exam1/exam2) Ask the user to enter two numbers (decimal

Can i get some help on the following requirements in C.

Modify the program Figure 2.6 (exam1/exam2) Ask the user to enter two numbers (decimal and a base 0 to 9) Write a loop: while (exam1 > 0 ) { // exam1 is the first number Inside the loop: Find the remainder when the first number is divided by the second and print it Assign the first number the result when the first number is divided by the second In other words, the program used to do this (Phase 2): 22 2 Divide = 11 Remainder = 0 Now it should do this 22 2 0 1 1 0 1 If you run it again: 20 8 4 2 If you run it again: 14 2 0 1 1 1 If you run it again: 62 8 6 7 In other words, you just wrote a converter from base10 decimal to base2 binary, base8 octal, etc.. If you read the output backwards: Base10 22 is base2 10110 Base10 20 is base8 24 Base10 14 is base2 1110 Base10 62 is base8 76

This is my code:

int main() { const int bonus = 10; int num1; int num2; int division; int remainder; printf("Enter two numbers; "); scanf("%d%d",&num1, &num2); division = num1 / num2; remainder = num1 % num2; printf("division = %d, remainder = %d ", division, remainder);

return (0); }

thank you

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

Students also viewed these Databases questions

Question

How can Trip 7 prevent future supply chain uncertainties?

Answered: 1 week ago