0% found this document useful (0 votes)
0 views3 pages

Lab 2-11

Uploaded by

santasnowyy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views3 pages

Lab 2-11

Uploaded by

santasnowyy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Q1)) Play with numbers!

Write a c code that asks the user to do the following:


1. Input a two-digit number such as (11, 25, 91, etc.)
2. Split the number into its digits, for example: 25 can be split into 2 and 5.
3. Check if the number has any of the following properties:
1. Repdigit/mono digit number: if both digits are equal.
(for example: 55 is a repdigit number).
2. Zuckerman number: Number that is divisible by the product of its digits.
(for example: 24/ (2*4) =3).
3. Niven number: Number that is divisible by the sum of its digits.
(for example: 36/ (3+6) = 4).
Note: If the number is not a two-digit number, warn the user to enter a two-digit number.
Sample output:
Q3)) Shapes and Areas
write a C program that performs the following:

➢ Let the user input one of the following characters: R for Rectangular, S for Square, C
for Circle, and T for Triangle
➢ If the user enters “r”, let the user enter the length and the width to compute the area
using the following equation: 𝒂𝒓𝒆𝒂 = 𝒍𝒆𝒏𝒈𝒕𝒉 ∗ 𝒘𝒊𝒅𝒕𝒉
➢ If the user’s choice is “s”, let the user enter the length and the width to compute the
area using the following equation: 𝒂𝒓𝒆𝒂 = 𝒍𝒆𝒏𝒈𝒕𝒉 ∗ 𝒍𝒆𝒏𝒈𝒕𝒉
➢ If the user enters “c”, let the user enter the length and the width to compute the area
using the following equation: 𝒂𝒓𝒆𝒂 = 𝟑. 𝟏𝟒 ∗ 𝒓𝒂𝒅𝒊𝒖𝒔 ∗ 𝒓𝒂𝒅𝒊𝒖𝒔
➢ If the user enters “t”, let the user enter the length and the width to compute the area
using the following equation: 𝒂𝒓𝒆𝒂 = 𝟎. 𝟓 ∗ 𝒃𝒂𝒔𝒆 ∗ 𝒉𝒆𝒊𝒈𝒉
➢ If the user enters an incorrect choice, a warning message is displayed as follows: “The
entered character is incorrect!!”

Sample Output:

You might also like