Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IE 1 0 0 5 - FROM COMPUTATIONAL THINKING TO PROGRAMMING AY 2 3 / 2 4 SPECIAL TERMS TAKE - HOME ASSIGNMENT 2 Instructions

IE1005- FROM COMPUTATIONAL THINKING TO PROGRAMMING AY23/24 SPECIAL TERMS TAKE-HOME ASSIGNMENT 2
Instructions
Save your source code as HW2_YourName. c and submit only HW2_YourName . c in NTULearn.
You are required to submit a video of yourself explaining the assignment solution. Refer to the instructions on video recording available in NTULearn.
You may resubmit as many times as you need until the deadline. Only the last file submitted before the deadline will be graded.
Ensure you submit the correct files. You will be graded based on the files that you submit.
Question ?()
Write a C program that finds common factors of two whole numbers. The program should do the following. The example user input is highlighted in red.
Prompt the user to enter a two-digit whole number.
Enter a two-digit whole number: 81
Generate and display a random number smaller than the user-entered number.
The second number is 63.
Compute and show their common factors.
Common factors of 81 and 63 are:
1
3
9
Display a sentence commenting on the number of common factors. The sentence should be in either singular or plural form, depending on the number of common factors.
There are 3 common factors of 81 and 63.
or
There is 1 common factor of 37 and 13.
Below are two more examples of the entire program run.
Enter a two-digit whole number: 48
The second number is 41.
Common factors of 48 and 41 are:
1
There is 1 common factor of 48 and 41.
Enter a two-digit whole number: 72
The second number is 46.
Common factors of 72 and 46 are:
1
2
There are 2 common factors of 72 and 46.
Note
You may assume that the user always provides a valid input.
Optimize your program for efficiency and easy reading.
Remember to style your code accordingly.
Marking schedule
Prompt the user and take the input
15 marks
1
image text in transcribed

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Analyze your fixed operating costs and calculate gross profit.

Answered: 1 week ago

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Why is interest in portable benefits in health care increasing?

Answered: 1 week ago