124x Filetype PDF File size 0.16 MB Source: www.uobabylon.edu.iq
Q1// write a general QBasic program to read grade for a student then print out the appreciation. Solution// CLS INPUT "Enter The Grade:"; Grade IF Grade >= 90 THEN PRINT "Excellent" ELSE IF Grade >= 80 THEN PRINT "V.Good" ELSE IF Grade >= 70 THEN PRINT "good " ELSE IF Grade >= 60 THEN PRINT " medium" ELSE IF Grade >= 50 THEN PRINT "Fair" ELSE PRINT "fail" END IF END IF END IF END IF END IF END **GoTo Statement. The general form Goto number of statement EX// Write a QBasic program to find y from the following sires Y=x+x2+x3+x4+…… Solution CLS 10 INPUT "input x,n"; x, n IF x <= 0 THEN PRINT "Re input x" GOTO 10 ELSE 20 i = i + 1 y = y + x ^ i IF i < n THEN 20 END IF PRINT "y="; y Ex// Write a QBasic program to find factorial . CLS INPUT "m"; m k = 1 10 i = i + 1 k = k * i IF i < m THEN 10 PRINT "fac.="; k EX// Write a QBasic program to find y from the following sires Solution// CLS INPUT "m,x"; m,x 20 i = i + 1 k = 1 j = 0 10 j = j + 1 k = k * j IF j < i THEN 10 y = y + x ^ i / k IF i < m THEN 20 PRINT "y="; y Write a QBasic program to print out the following triangle. 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Solution 10 i = i + 1 j = 0 20 j = j + 1 PRINT j; IF j < i THEN 20 PRINT IF i < 5 THEN 10
no reviews yet
Please Login to review.