0% found this document useful (0 votes)
97 views4 pages

Student HandOut Questions

This document contains 13 programming exercises for students in a structured programming fundamentals course. The exercises involve writing programs to calculate the area and perimeter of a rectangle based on user input dimensions, finding the average of 5 integers, exchanging the values of two variables, calculating the distance between two points in a plane, determining if a student passed or failed based on marks in three subjects, performing basic mathematical operations on two numbers based on a user-selected operator, checking if two numbers are multiples, determining if two numbers are positive, negative, even or odd, finding the smallest and largest of three numbers, calculating the area of a circle based on radius, converting a lowercase letter to uppercase, encrypting text by shifting each character to the next

Uploaded by

Mera Karam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views4 pages

Student HandOut Questions

This document contains 13 programming exercises for students in a structured programming fundamentals course. The exercises involve writing programs to calculate the area and perimeter of a rectangle based on user input dimensions, finding the average of 5 integers, exchanging the values of two variables, calculating the distance between two points in a plane, determining if a student passed or failed based on marks in three subjects, performing basic mathematical operations on two numbers based on a user-selected operator, checking if two numbers are multiples, determining if two numbers are positive, negative, even or odd, finding the smallest and largest of three numbers, calculating the area of a circle based on radius, converting a lowercase letter to uppercase, encrypting text by shifting each character to the next

Uploaded by

Mera Karam
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Faculty of Computer & Informatics

Section_1
Fundamental of Structured Programming
Lab Handout Questions First Year 2/19/2012

EXERCISE 1
Write a program that asks the user to type the width and the length of a rectangle and then outputs to the screen the area and the perimeter of that rectangle.

EXERCISE 2
Write a program that asks the user to type 5 integers and writes the average of the 5 integers. This program can use only 2 variables.

EXERCISE 3
Write a program that asks the user to type 2 integers A and B and exchange the value of A and B.

EXERCISE 4
Write a program that asks the user to type the coordinate of 2 points, A and B (in a plane), and then writes the distance between A and B.

EXERCISE 5
Write a C++ program to accept from the user 3 marks for a student out of 100 and outputs whether the student passed or failed. The passing grade for each subject is 40. The student passes if he passes in all three subjects, moreover the student also passes if he fails in only one subject but the average of his grades is greater than or equal to 50. Otherwise the student fails. Enter the grades: 35 60 75 The student passed.

2|Page

EXERCISE 6
Write a program that takes two arguments (x and y) and one operator (+, *, - , /) and returns only one result. (Use switch case)

EXERCISE 7
Write a program that asks the user to enter two numbers and check if they are a multiple or not.

EXERCISE 8
Write a program that asks the user to type 2 integers and check if them are positive, negative, even or odd.

EXERCISE 9
Write a program that asks the user to enter three integers A and B and return the smallest and largest number on them.

EXERCISE 10
Write a program that calculates the area of a circle whose radius is supplied by the user.

EXERCISE 11
Write a program that asks the user for a lowercase letter of the alphabet and then prints its equivalent uppercase letter.

3|Page

EXERCISE 12 (H.W.)
Write an encrypting program that converts each character received into the next character in the alphabet. As a special case, convert z into a.

EXERCISE 13 (H.W.)
Write a program that neatly prints a table of powerssquares and cubes. Print these powers for the integers from 1 to 100. The first few lines of the table might appear as follows:

integer 1 2 ..

square 1 4 ..

cube 1 8 ..

4|Page

You might also like