Skip to main content
Project work of computer
Qbasic programs:
A. Write a program that asks mark in any subject and display the message "Result Pass" if the input number is greater than 40.
CLS INPUT "Enter marks in computer"; C IF C> = 40 THEN PRINT "RESULT PASS" ELSE PRINT "RESULT FAIL" END
B. Write a program that asks any two numbers and displays the greater one.
CLS INPUT "ENTER FIRST NUMBER";A INPUT "ENTER SECOND NUMBER";B IF A>B THEN PRINT " THE GREATER NUMBER IS";A ELSE PRINT "THE GREATER NUMBER IS";B END IF END
C. Write a program that checks whether the supplied number is odd or even.
CLS INPUT "ENTER ANY NUMBER";N IF N MOD 2=0 THEN PRINT "EVEN NUMBER" ELSE PRINT "ODD NUMBER" END IF END
D.Write a program that asks two numbers and displays the difference between greater and smaller number.
CLS INPUT "ENTER FIRST NUMBER";A INPUT "ENTER SECOND NUMBER";B IF A>B THEN D= A-B ELSE D= B-A END IF PRINT "DIFFERENCE OF GREATER AND SMALLER NUMBER=";D END
E.write a program to enter age and check weather you are eligigible to vote or not CLS INPUT "ENTER YOUR AGE";A IF A>=18 THEN PRINT "YOU ARE ELIGIBLE TO VOTE" ELSE PRINT "YOU ARE NOT ELIGIBLE TO VOTE" END IF END
F. Write a program to print the smallest among 3 numbers.
CLS INPUT "ENTER ANY THREE NUMBERS"; A,B,C IF A<B AND A< C THEN PRINT "THE SMALLEST NUMBER IS"; A ELSE IF B<A AND B<C THEN PRINT "THE SMALLEST NUMBER IS "; B ELSE PRINT "THE SMALLEST NUMBER IS";C END IF END
G. Write a program that asks marks in 3 subjects and display message Pass or Fail.
CLS INPUT "ENTER MARKS IN THREE SUBJECT"; A,B,C IF A>=40 B>=40 AND C>=40 THEN PRINT "YOU ARE PASS" ELSE PRINT "YOU ARE FAIL" END IF END
H. Write a program to using FOR...NEXT statement to print natural numbers up to 15.
CLS FOR I = 1 TO 15 PRINT I NEXT I END
I. Write a program using FOR...NEXT statement to print even numbers from 2 to 20.
CLS FOR I = 2 TO 20 STEP 2 PRINT I NEXT I END
J.Write a program using FOR...NEXT statement to print first 10 odd numbers.
CLS FOR I = 1 TO 20 STEP 2 PRINT I NEXT I END
K.Write a program using FOR...NEXT statement to generate numbers: 2,5,8,11...32.
CLS FOR I = 2 TO 32 STEP 3 PRINT I NEXT I END
L. Write a program to print: 100,95,90...5.
CLS FOR I = 100 TO 5 STEP -5 PRINT I NEXT I END
N. Write a program to print sum of first 15 natural numbers.
CLS FOR I = 1 TO 15 S = S+I NEXT I PRINT "SUM="; S END
O. Write a program using FOR...NEXT statement to print even numbers from 2 to 20.
CLS FOR I = 2 TO 20 STEP 2 S = S+I NEXT I PRINT "SUM="; S END
P. Write a program to print sum of odd numbers from 1 to 21.
CLS FOR I = 1 TO 21 STEP 2 S = S+I NEXT I PRINT "SUM="; S END
Q. Write a program to print even numbers from 20 to 40.
CLS FOR I = 20 TO 40 STEP 2 PRINT I NEXT I END
R. Write a program to find product of first 10 natural number.
CLS P = 1 FOR I = 1 TO 10 P= P * 1 NEXT I PRINT "PRODUCT=";P END
S. Write a program to generate multiplication table of input.
CLS INPUT " ENTER ANY NUMBER="; N FOR I = 1 TO 10 PRINT N; "X" 1; "="; N * I NEXT I END
Comments
Post a Comment