Tuesday, June 5, 2012

Greater, Less, Divisible

Assalamu Alaikum. Hope you all are well by the grace of Almighty ALLAH. Today we learn some problems for if-else statement. Let's look at the problems.

Problem 1: Write a program to find a given number is greater than 100 and less than 250 and divisible by 7.


Solution:


















Problem 2: Write a program to find a given number is greater than 100 and less than 250 or divisible by 7.

Solution:




















Problem 3: Write a program to find a given number is greater than 100 or less than 250 and divisible by 7.

Solution:





















We can also do this program by the following way.




















In this program in line no. 10 & 11 if is used twice. This type of if is called nested if.

Thank you all..:)

0 comments:

Post a Comment