0% found this document useful (0 votes)
2 views15 pages

Basic Programming Exercises with Solutions

The document outlines a series of programming tasks, each requiring the creation of a program to perform specific functions such as summing two numbers, checking if a number is even or odd, and finding the factorial of a number. Each task includes a placeholder for source code and output. The tasks cover a range of basic programming concepts suitable for beginners.

Uploaded by

dj395811
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)
2 views15 pages

Basic Programming Exercises with Solutions

The document outlines a series of programming tasks, each requiring the creation of a program to perform specific functions such as summing two numbers, checking if a number is even or odd, and finding the factorial of a number. Each task includes a placeholder for source code and output. The tasks cover a range of basic programming concepts suitable for beginners.

Uploaded by

dj395811
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

1.

Write a program to input two numbers and print their


sum.

Source Code :-

Output:-

1
2. Write a program to check whether a number is even or
odd.

Source Code:-

Output:-

2
3. Write a program to check whether a student is pass or
fail.

Source Code:-

Output:-

3
4. Write a Program to print the larger of two numbers.

Source Code:-

Output:-

4
5. Write a program to find factorial of a number

Source code:-

Output:-

5
6. Program to check if number is positive, negative or zero.

Source Code:-

Output:-

6
7. Write a Program to count vowels in a string.

Source Code:-

Output:-

7
8. Write a Program to check prime number.

Source Code:-

Output:-

8
9. Write a Program to find sum of digits of a number.

Source Code:-

Output:-

9
10. Write program to reverse a string.

Source Code:-

Output:-

10
11. Write a program to find the largest and smallest
number in a list.

Source Code:-

Output:-

11
12. Write a Program to check leap year.

Source Code:-

Output:-

12
13. Write a Program to count digits in a number.

Source Code:-

Output:-

13
14. Write a program to calculate the average of 5 numbers.

Source Code:-

Output:-

14
15. Write a Program to calculate the perimeter of a
rectangle.

Source Code:-

Output:-

15

You might also like