[go: up one dir, main page]

0% found this document useful (0 votes)
7 views2 pages

C Program Practice Problems

C Program Language Problems

Uploaded by

engrleam23101
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)
7 views2 pages

C Program Practice Problems

C Program Language Problems

Uploaded by

engrleam23101
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/ 2

Problem 1: Write a C Programming that will compute and display the average of two inputted numbers

that will determine if an inputted number is even or odd and display "EVEN" if the number is even else
display "ODD"

Problem 2: Write the C Program that allow user to input the length and the width of a rectangle,
compute the perimeter of the rectangle.

Problem 3: Write the C Program that will Allow user to input the length and the width of a rectangle.
Display the perimeter of the rectangle. If the length is equal to the width ☐ Then print " The rectangle is
a square". ☐ Otherwise print "The rectangle is not a square".

Problem 4: Write a C program that will display the numbers from 1 to 10.

Problem 5: Write a C program that allows input of a temperature in degree Celsius. It will then convert
and display its equivalent temperature in degrees Fahrenheit. Note: F = (9/5)C+32

Problem 6: Write a C program that allows input of two fractions A and B. Assume that fraction A is
represented by Anum and Aden for numerator and denominator respectively. Fraction B is also
represented by Bnum and Bden. The pseudocode will determine and display the fraction representing
the product of fractions A and B.

Problem 7: Write a C program which will input two numbers and display the GCF (greatest common
factor). Hint: See Euclids Algorithm GCF? Euclid's algorithm

Problem 8: Write a program which will input two numbers, and display the LCM (Least Common
Multiple) LCM?

Problem 9: Write a PROGRAM that allows input of two fractions A and B. Assume that fraction A is
represented by Anum and Aden for numerator and denominator respectively. Fraction B is also
represented by Bnum and Bden. The pseudocode will determine and display the fraction representing
the product of fractions A and B. The pseudocode will determine and display the fraction representing
the sum of fraction A and B. The resulting fraction should be in its simplest form.

Problem 10: Write a C program that allows input of a number. The program will display the sum of all the
digits in the inputted number. This is done by continuously extracting the ones digit using modulo
operator and removing the ones digit by dividing the number by 10 until the inputted number becomes
zero.
Problem 11: The user wants to donate books to a library. To make things easier, the books will be placed
inside boxes. Each box can only contain 6 books. Write a C program that allows the user to input the
number of books to be donated which will be placed inside boxes. The pseudocode will display the
number of boxes to be used. Remaining books less than 6 will still be placed in 1 box.

Problem 12: Write a program, which allows input of the two sides A and B of quadrilateral (a polygon
with 4 sides). If side A and B is equal to side B then the quadrilateral is a square. Determine the area of
the square and output “The are of the square is X”, where X is the value of the area. If the side A is not
equal to side B, determine the perimeter of the quadrilateral and output “The perimeter is Y”, where Y is
the value of the perimeter. The perimeter P = 2A+2B, where A and B are the two sides of the
quadrilateral.

Problem 13: The user is required to input many float values and will stop inputting values only when the
last inputted value is 0 (zero). The total number of inputted values is recorded (excluding 0) and
displayed together with accurate average.

Problem 14: Write a program that display the numbers from 1 to N

Problem 15: Write a function that will accept as its parameter an Integer N. The function will display
either of the following: “Negative” -> if N is less than 0 “Positive” -> if N is greater than 0. “Zero” -> if N is
0.

You might also like