Practice questions on Input by user
1. Write a program to take two integer inputs from user and print sum and product
of them.
2. Take two integer inputs from user. First calculate the sum of two then product of
two. Finally, print the sum and product of both obtained results.
3. Ask user to give two double input for length and breadth of a rectangle and print
area type casted to int.
4. Take name, NIDA number and field of interest from user and print in the format
below:
Hey, my name is xyz and my NIDA number is xyz. My field of interest is xyz.
v
Take side of a square from user and print area and perimeter of it.
a
. Write a program to find square of a number.
Eg-
INPUT:2 OUTPUT: 4
INPUT:5 OUTPUT: 25
7. Take two different string input and print them in same line. E.g.-
INPUT : Programming
Methodology
OUTPUT : Programming Methodology
. Take 3 inputs from user and check :
~
all are equal
any of two are equal
(use && || )
9. Write a program to enter the values of two variables
and’b' from keyboard and
then check if both the conditions'a < 50’ and'a