Search This Blog

Monday, June 25, 2018

Homework

1. Write a program to input any number and check whether the given number is divisible by 3 and 7 or not.


CLS

INPUT "Enter any number";N
IF N MOD 3=0 AND N MOD 7=0 THEN
PRINT "The number is divisible by 3 and 7"
ELSE
PRINT "The number is not divisible by 3 and 7"
END IF
END


2. Write a program to input any number and check whether the give number is positive or negative.
CLS
INPUT "Enter any number";N
IF N>0 THEN
PRINT "The given number is positive"
ELSEIF N<0 THEN
PRINT "The given number is negative"
END IF
END


3.Write a program to input any number and display whether it is odd or even.
CLS
INPUT "Enter any number";N
IF N MOD 2=0 THEN
PRINT "The given number is even"
ELSE
PRINT "The given number is odd"
END IF
END

4. Write a program to enter any two numbers and display the smaller one.
CLS
INPUT "Enter any two numbers";A,B
IF A<B THEN
PRINT "The smallest number is";A
ELSE
PRINT "The smallest number is";B
END IF
END


5.Write a program to enter any three numbers and display the middle number.
CLS
INPUT "Enter any three numbers";A,B,C
IF A>B AND A<C OR A<B AND A>C THEN
PRINT "The middle number is";A
ELSEIF B>A AND B<C OR B<A AND B>C THEN
PRINT "The middle number is";B
ELSE 
PRINT "The middle number is";C
END IF
END


6.Write a program to test whether a user input number is completely divisible by 13 or not.
CLS
INPUT "Enter any number";N
IF N MOD 13=0 THEN
PRINT "The number is completely divisible by 13"
ELSE
PRINT "The number is not completely divisible by 13"
END IF 
END


7.Write a program to check whether a input number is positive, negative or zero.
CLS
INPUT "Enter any number";N
IF N>0 THEN 
PRINT "The number is positive"
ELSEIF N<0 THEN 
PRINT "The number is negative"
ELSE
PRINT "The number is zero"
END IF
END

8. Write a program to input a year and display whether that year is a leap year or not.
CLS
INPUT "Enter year";Y
IF Y MOD 4=0 AND Y MOD 100 < > 0 OR Y MOD 400=0 THEN
PRINT "The year is leap year"
ELSE
PRINT "The year is not leap year"
END IF 
END


9. Input the age of a person and find out whether the person is eligible to drive or not.
CLS
INPUT "Enter your age";A
IF A>= 16 THEN
PRINT "You are eligible to drive"
ELSE
PRINT "You are not eligible to drive"
END IF 
END


10.Write a program to enter any three numbers and display the greatest one.
CLS
INPUT "Enter any three numbers"; A,B,C
IF A>B AND A>C THEN
PRINT "The greatest number is";A
ELSEIF B>A AND B>C THEN 
PRINT "The greatest number is";B
ELSE
PRINT "The greatest number is";C
END IF 

END

No comments:

Post a Comment

My journy with Jagat Mandir

10 years of journy with JM it was the most important day of my life i spend my 10 years with this school . I am so happy that i could spend...