0% found this document useful (0 votes)
17 views1 page

Lab 1

The document provides 20 programming problems involving the use of input/output statements, conditional statements, and looping statements. The problems cover calculating the volume of a sphere, finding the average or smallest of three numbers, determining if a number is even or odd, calculating profit or loss, checking if marks meet pass criteria, determining if a number is positive/negative/neutral, and more.

Uploaded by

erloos236
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)
17 views1 page

Lab 1

The document provides 20 programming problems involving the use of input/output statements, conditional statements, and looping statements. The problems cover calculating the volume of a sphere, finding the average or smallest of three numbers, determining if a number is even or odd, calculating profit or loss, checking if marks meet pass criteria, determining if a number is positive/negative/neutral, and more.

Uploaded by

erloos236
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

Lab Assignment 1(Use of I/O statement, conditional statements and looping statements)

1. Write a program to calculate the volume of the sphere. [v=4/3πr3]


2. Write a program to display the average of any three numbers.
3. Write a program to display the smallest number among any three numbers given by the user.
4. Write a program to display whether the given number is even or odd by using Switch Case
statement.
5. Write a program to calculate the profit or loss amount when Selling price and Cost price is given.
6. Write a program to input the marks of any three subjects and display whether the student is pass
or fail. [Assume the pass marks of each subject is 40]
7. Write a program to check whether the given number is positive, negative or neutral.
8. Write a program to display the sum, product and difference of any two numbers given by the
user. The program should display sum if user enters 1, product if user enters 2 and difference if
user enters 3 by using Switch Case statement.
9. Write a program to display all the even numbers from 2 to 100.
10. Write a program to display the following series.
a. 1 4 9 16………………….upto 10th terms.
b. 100 97 94 91 ………….upto 10th terms
c. 3 33 333 3333 33333
d. 100 81 64 49 ………………upto 10th terms
11. Write a program to display the multiplication table of the given number.
12. Write a program to display the given number in reverse order.
13. Write a program to display the number in the following pattern.
1234 54321 12345
2345 5432 1234
345 543 123
45 54 12
5 5 1

14. Write a program to display the factorial of the given number.


15. Write a program to display whether the given number is Armstrong or not.
16. Write a program to display the multiplication table of all the numbers from 1 to 5.
17. Write a program to display the factors of the given number.

18. Write a program to display whether the given number is prime or composite.

19. Write a program to display all the prime numbers from 2 to 1000.

20. Write a program to input ‘n’ numbers from the user and count the even and odd numbers
separately.

You might also like