You are on page 1of 1

Q1.

Accept any two numbers, if the first number is greater than second then print the sum of
these two numbers, otherwise print their difference. Write this program using ternary
operator.

Q2. WAP to check whether a given number is prime or not.

Q3. WAP to find factorial of a number.

Q4. A five-digit number is entered through the keyboard. Write a program to obtain the
reversed number and to determine whether the original and reversed numbers are equal or
not.

Q5. Any year is input through the keyboard. Write a program to determine whether the year
is a leap year or not.

Q6. If the three sides of a triangle are entered through the keyboard, write a program to check
whether the triangle is valid or not and also check whether the triangle is isosceles,
equilateral, scalene or right angled triangle.

Q7. Write a program to find out the value of x raised to the power y, where x and y are
positive integers.

Q8. Write a program to print out all Armstrong numbers between 1 and 500.

Q9. Write a program to find out the Least Common Multiple, and Highest Common Factor of
two numbers.

Q10. WAP to print the following patterns.

You might also like