Professional Documents
Culture Documents
Share 'Question Paper 1.doc'
Share 'Question Paper 1.doc'
if (bill>10000)
else
c) Give the output of the following program segment and also mention how many times the loop is
executed :
int i;
a. The relative velocity of two trains travelling in opposite direction is calculated by adding their
velocity. In case the trains are traveling in the same direction, the relative velocity is the
difference between their velocities.write a program to input velocities and length of the trains
and find the relative velocities and the time taken to cross each other.(using Switch case)
b. Write a java program using switch case and loop to find out the sum of the following series as
per users choice:
a) 1+1+2+3+5+...........upto n terms
b) 1+(1*2)+(1*2*3)+.............. +(1*2*3*.........*n)
c) 1+(1+2)+(1+2+3)+.............+(1+2+3+..........+n)
C.write java program to check if a number is a special two digit number and niven number or not.
d)