0% found this document useful (0 votes)
5 views

Programming-Sheet2 - Answers

The document provides programming problems and exercises related to C++ programming including checking if a character is an alphabet, changing a string to lowercase, counting zeros in a binary number, removing numbers from a string, identifying leap years, calculating GCD of two numbers, finding smallest and largest elements in an array, calculating product and reversing digits of a number, swapping variables without an extra variable, counting sum of numbers in a string, and printing patterns using loops.

Uploaded by

ahmedtarek544a
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Programming-Sheet2 - Answers

The document provides programming problems and exercises related to C++ programming including checking if a character is an alphabet, changing a string to lowercase, counting zeros in a binary number, removing numbers from a string, identifying leap years, calculating GCD of two numbers, finding smallest and largest elements in an array, calculating product and reversing digits of a number, swapping variables without an extra variable, counting sum of numbers in a string, and printing patterns using loops.

Uploaded by

ahmedtarek544a
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Computer Programming 1

Faculty of Computers & Informa on system


Level 1

Sheet #2
Using C++ :
2.Write a Program to Print Check Whether a Character is an Alphabet or Not

4.Write a Program to change a String into lower case.

Solution2:
5.Write a Program to Count the Number of zeros in a binary number.

6.Write a Program to Remove All Numbers from a String

Solution2:
7.Write a Program to Find a year that is Leap Year

8.Write a Program to Calculate the (GDC) of Two Numbers


9.Write a Program to Find the Smallest and Largest Element in an Array

10.Read the value N and calculate product of its digits.

11.Read the value N and print its digits in reverse order.


13.Write a Program to Swap the Values of Two Variables without Using any
extra variable.

14.Write a Program to Count the Sum of Numbers in a String

15.Print the following patterns using loops:

You might also like