Programming is Kinda Fun (Part 3)
1. WAP to find the are of four walls.
=> CLS
INPUT "Enter length"; l
INPUT "Enter breadth"; b
INPUT "Enter height"; h
A = 2 * h* (l + b)
PRINT "Area of four walls = "; A
END
2. WAP to display are of triangle.
=> CLS
INPUT "Enter height"; h
INPUT "Enter base"; b
A =1/2 * b * h
PRINT "Area of triangle = "; A
END
3. WAP to display area of parallelogram.
=> CLS
INPUT "Enter base"; b
INPUT "Enter height"; h
A = b * h
PRINT "Area of parallelogram = "; A
END
4. WAP to display volume of cylinder.
=> CLS
INPUT "Enter radius of base "; b
INPUT "Enter height of cylinder" ; h
V = 22/7 * r ^ 2 * h
PRINT "Volume of cylinder ="; V
END
5. WAP to display TSA of sphere.
=> CLS
INPUT "Enter radius" ; r
TSA = 4 * 22/7 * r ^ 2
PRINT "Total surface Area ="; TSA
END
6. WAP to display volume of sphere.
=> CLS
INPUT "Enter radius"; r
V = 4/3 * 22/7 * r ^ 3
PRINT "Volume of sphere ="; V
END
7. WAP to display volume of hemisphere.
=> CLS
INPUT "Enter radius"; r
V = 2/3 * 22/7 * r ^ 3
PRINT "Volume of hemisphere ="; V
END
8. WAP tp display TSA of cylinder.
=> CLS
INPUT "Enter radius"; r
INPUT "Enter height" ; h
TSA = 2 * 22/7 * r * (r + h)
PRINT "Total Surface Area = "; TSA
END
9. WAP to display volume of cylinder.
=> CLS
INPUT "Enter radius"; r
INPUT "Enter height"; h
V = 22/7 * r ^2 * h
PRINT "Volume of cylinder = "; V
END
10. WAP to check whether the given number is divisible by 5 or not.
=> CLS
INPUT "Enter any number"; A
R = A MOD 5
IF R = 0 THEN PRINT "Number is divisible by 5" ELSE PRINT "Number is not divisible by 5"
END
11. WAP to check whether the given number is divisible by 4 and 5 or not.
=> CLS
INPUT "Enter any number"; A
R1 = A MOD 4
R2 = A MOD 5
IF R1 = 0 AND R2 = 0 THEN PRINT "Number is divisible by 4 and 5" ELSE PRINT "Number is
not divisible by 4 and 5"
END
12. WAP to check whether the given number is a multiple of 10 or not.
=> CLS
INPUT "Enter any number"; A
R = A MOD 10
IF R = 0 THEN PRINT "Number is a multiple of 10" ELSE PRINT "Number is not a multiple of 10"
END
13. WAP to check whether the given number is odd or even.
=> CLS
INPUT "Enter any number"; A
R = A MOD 2
IF R = 0 THEN PRINT "Number is even" ELSE PRINT "Number is odd"
END
14. WAP TO check whether the given number is divisible by 7 or not.
=> CLS
INPUT "Enter any number"; A
R = A MOD 7
IF R = 0 THEN PRINT "Number is divisible by 7" ELSE PRINT "Number is not divisible by 7"
END
15. WAP to check whether the given number is positive, negative or zero.
=> CLS
INPUT "Enter any number"; A
IF A>0 THEN
PRINT A ; " is positive number"
ELSEIF A<0 THEN
PRINT A ; " is negative number"
ELSE
PRINT A ; " is zero"
END IF
END
16. WAP to display the greatest number among three numbers.
=> CLS
INPUT "Enter any 3 numbers"; A, B, C
IF A>B AND A>C THEN
PRINT A ; "is greatest number"
IF B >A AND B>C THEN
PRINT B ; "is greatest number"
ELSE
PRINT C : " is greatest number"
END IF
END
17. WAP to display the smallest number among three numbers.
=> CLS
INPUT "Enter any 3 numbers"; A, B, C
IF A<B AND A<C THEN
PRINT A ; "is smallest number"
IF B <A AND B<C THEN
PRINT B ; "is smallest number"
ELSE
PRINT C : " is smallest number"
END IF
END
18. WAP to enter secured percentage and display the division.
=> CLS
INPUT "Enter secured percentage"; P
IF P>= 60 THEN
PRINT "You have passed in first division"
ELSEIF P>=50 AND P<=59.9 THEN
PRINT "You have passed in second division"
ELSEIF P>=40 AND P<=49.9 THEN
PRINT "You have passed in third division"
ELSE
PRINT "You have failed"
END IF
END
19. WAP to enter age and give advice accordingly.
=> CLS
INPUT "Enter age"; A
IF A<15 THEN
PRINT "You are young, study hard"
ELSEIF A>=15 AND A<=30 THEN
PRINT "You are adult, work hard"
ELSEIF A>=31 AND A<=60 THEN
PRINT "You are mature, work slowly"
ELSE
PRINT "You are old, take rest"
END IF
END
=> CLS
INPUT "Enter length"; l
INPUT "Enter breadth"; b
INPUT "Enter height"; h
A = 2 * h* (l + b)
PRINT "Area of four walls = "; A
END
2. WAP to display are of triangle.
=> CLS
INPUT "Enter height"; h
INPUT "Enter base"; b
A =1/2 * b * h
PRINT "Area of triangle = "; A
END
3. WAP to display area of parallelogram.
=> CLS
INPUT "Enter base"; b
INPUT "Enter height"; h
A = b * h
PRINT "Area of parallelogram = "; A
END
4. WAP to display volume of cylinder.
=> CLS
INPUT "Enter radius of base "; b
INPUT "Enter height of cylinder" ; h
V = 22/7 * r ^ 2 * h
PRINT "Volume of cylinder ="; V
END
5. WAP to display TSA of sphere.
=> CLS
INPUT "Enter radius" ; r
TSA = 4 * 22/7 * r ^ 2
PRINT "Total surface Area ="; TSA
END
6. WAP to display volume of sphere.
=> CLS
INPUT "Enter radius"; r
V = 4/3 * 22/7 * r ^ 3
PRINT "Volume of sphere ="; V
END
7. WAP to display volume of hemisphere.
=> CLS
INPUT "Enter radius"; r
V = 2/3 * 22/7 * r ^ 3
PRINT "Volume of hemisphere ="; V
END
8. WAP tp display TSA of cylinder.
=> CLS
INPUT "Enter radius"; r
INPUT "Enter height" ; h
TSA = 2 * 22/7 * r * (r + h)
PRINT "Total Surface Area = "; TSA
END
9. WAP to display volume of cylinder.
=> CLS
INPUT "Enter radius"; r
INPUT "Enter height"; h
V = 22/7 * r ^2 * h
PRINT "Volume of cylinder = "; V
END
10. WAP to check whether the given number is divisible by 5 or not.
=> CLS
INPUT "Enter any number"; A
R = A MOD 5
IF R = 0 THEN PRINT "Number is divisible by 5" ELSE PRINT "Number is not divisible by 5"
END
11. WAP to check whether the given number is divisible by 4 and 5 or not.
=> CLS
INPUT "Enter any number"; A
R1 = A MOD 4
R2 = A MOD 5
IF R1 = 0 AND R2 = 0 THEN PRINT "Number is divisible by 4 and 5" ELSE PRINT "Number is
not divisible by 4 and 5"
END
12. WAP to check whether the given number is a multiple of 10 or not.
=> CLS
INPUT "Enter any number"; A
R = A MOD 10
IF R = 0 THEN PRINT "Number is a multiple of 10" ELSE PRINT "Number is not a multiple of 10"
END
13. WAP to check whether the given number is odd or even.
=> CLS
INPUT "Enter any number"; A
R = A MOD 2
IF R = 0 THEN PRINT "Number is even" ELSE PRINT "Number is odd"
END
14. WAP TO check whether the given number is divisible by 7 or not.
=> CLS
INPUT "Enter any number"; A
R = A MOD 7
IF R = 0 THEN PRINT "Number is divisible by 7" ELSE PRINT "Number is not divisible by 7"
END
15. WAP to check whether the given number is positive, negative or zero.
=> CLS
INPUT "Enter any number"; A
IF A>0 THEN
PRINT A ; " is positive number"
ELSEIF A<0 THEN
PRINT A ; " is negative number"
ELSE
PRINT A ; " is zero"
END IF
END
16. WAP to display the greatest number among three numbers.
=> CLS
INPUT "Enter any 3 numbers"; A, B, C
IF A>B AND A>C THEN
PRINT A ; "is greatest number"
IF B >A AND B>C THEN
PRINT B ; "is greatest number"
ELSE
PRINT C : " is greatest number"
END IF
END
17. WAP to display the smallest number among three numbers.
=> CLS
INPUT "Enter any 3 numbers"; A, B, C
IF A<B AND A<C THEN
PRINT A ; "is smallest number"
IF B <A AND B<C THEN
PRINT B ; "is smallest number"
ELSE
PRINT C : " is smallest number"
END IF
END
18. WAP to enter secured percentage and display the division.
=> CLS
INPUT "Enter secured percentage"; P
IF P>= 60 THEN
PRINT "You have passed in first division"
ELSEIF P>=50 AND P<=59.9 THEN
PRINT "You have passed in second division"
ELSEIF P>=40 AND P<=49.9 THEN
PRINT "You have passed in third division"
ELSE
PRINT "You have failed"
END IF
END
19. WAP to enter age and give advice accordingly.
=> CLS
INPUT "Enter age"; A
IF A<15 THEN
PRINT "You are young, study hard"
ELSEIF A>=15 AND A<=30 THEN
PRINT "You are adult, work hard"
ELSEIF A>=31 AND A<=60 THEN
PRINT "You are mature, work slowly"
ELSE
PRINT "You are old, take rest"
END IF
END
Comments
Post a Comment