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

Ass1_2025

The document outlines a series of programming assignments focused on basic arithmetic operations, geometric calculations, data type sizes, and user input handling. Each question requires the creation of a specific program, such as calculating sums, areas, interest, and temperature conversions, as well as implementing conditional logic and loops. The assignments are designed to enhance programming skills and understanding of fundamental concepts in coding.

Uploaded by

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

Ass1_2025

The document outlines a series of programming assignments focused on basic arithmetic operations, geometric calculations, data type sizes, and user input handling. Each question requires the creation of a specific program, such as calculating sums, areas, interest, and temperature conversions, as well as implementing conditional logic and loops. The assignments are designed to enhance programming skills and understanding of fundamental concepts in coding.

Uploaded by

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

Assignment 1

Q.1
a. Write a program to calculate sum of two numbers.
b. Write a program to calculate average of given numbers.
Q.2
a. Write a program to calculate area of circle
b. Write a program to calculate circumference of circle
c. Write a program to calculate area of rectangle
d. Write a program to calculate area of triangle
Q.3 Write a program to calculate simple interest
Q.4 Write a program to print next four character of given character
Q.5 Write a program to convert temperature
a) Celsius to Fahrenheit
b) Celsius to Kelvin
c) Fahrenheit to Kelvin.
Q.6 Write a program to swap two numbers using three variables
Q.7 Write a program to swap two numbers using three two variables
Q.8 Write a program to find size of primitive data types.
Q. 9 Write a program which asks for a number input from the keyboard. Add 40 to the
number and then divide it by 5. Now, take modulus of that number with 2 and then multiply
the resultant
value by 10. Display the result.
Q.10 Write a program which asks for names of subjects (minimum 7), and then ask for marks
in each subject one by one. After the input, it should display the marks of subjects against
their name (use set() manipulator). At the end, it should display the total calculated
percentage marks (assume each subject has a maximum of 100 marks)
Q.11 Write a program which takes temperature in Celsius as input and then display the values
after converting it to Kelvin and Fahrenheit.
Q.12 Write program for Q. No. 9 using assignment operators (+=, /=, %=, *=).
Q.13 Write a program which takes purchase price and selling price of a product as user input.
It
should then check if you got profit or loss and then it should display the amount of profit or
loss.
Q.14 Write a program which takes angles of a triangle as input and check if the triangle is
valid
or not.
Q.15 Write a program which takes hours and minutes as user input and show whether the
time
is AM or PM.
Q.16 Write a program which takes an integer as user input and if it is odd then convert it to
its
upper even number.
Q.17 Write a program which takes two values as user input and then swap the values of the
two
variables to which those are assigned.
Q.18 Write a program to find all roots of a quadratic equation using if else. Take co-efficient
of the
quadratic equation as user input. Check for negative, positive or zero discriminant and
calculate
roots accordingly.
Q.19 Write a program which takes the value from the user as input electricity unit charges
and
calculate total electricity bill according to the given condition. Use if-else statement.
a. For the first 50 units Rs. 0.50/unit
b. For the next 100 units Rs. 0.75/unit
c. For the next 100 units Rs. 1.20/unit
d. For unit above 250 Rs. 1.50/unit
e. An additional surcharge of 20% is added to the bill.
Q.20 Write a program to demonstrate the use of arithmetic operators.
Q.21 Write a program to multiply two numbers without using * (Asterisk/Multiplication)
operator.

You might also like