QBASIC PROGRAMS

                                                     QBASIC 
1. 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

2. 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

3. 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

4.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

5.Write a program that asks your age and tells whether you are eligible 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

6. 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 


7. 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

8. 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

9. 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  

10.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

11.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

12. Write a program to print: 100,95,90...5.

             CLS
             FOR I = 100 TO 5  STEP -5
             PRINT I
             NEXT I
             
END

13. 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

14. 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


15. 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

16. Write a program to print even numbers from 20 to 40.

                  CLS
                  FOR I = 20 TO 40  STEP 2
                 PRINT I
                 NEXT I
                 END

17. 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

18. 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

  1. This comment has been removed by the author.

    ReplyDelete
  2. I am manas ka birthday h aa raha h valid ka photo bhejo na plz mere pass h but confirm Karna tha kya To Help me to come over and ie I was in my life is good for me and my mom and sister and I have to be in my room for me to come over to the hospital for my 👪 to the hospital and the other day I can get a chance to see if I was going through my phone died on the way to the gym and I don't want me too 👶 👧 I love the fact is a good night and I will try and find the right one will come 🔙 to the hospital for the day I will try my hardest to be with me for my family and friends and family and friends and I have to eat at home with me for my family and the kids to bed now so I have no idea how much I love the fact that I have a good night and sweet and sour cream and a half day is going to be a great day until now and then I have a good 🌃 baby I love it so I can see you in a while and I have no idea what to say that to you too 👶 👧 is a good night and I have no 💡 where it is a fake smile on my way home and get a chance to see the new one is for you guys doing anything for the day before I get to the clipboard in the morning to get a chance to see the new one is for me too baby girl is a good night and I have no idea how long are you going to bed soon so I don't want to go to the hospital for the day before yesterday I had the best for the first one was there to see you in my head is killing it on your way home from work today so I'm going to be a great time with it all the way I've been the best it r u ur uy6 tg 6 u4 ur

    ReplyDelete
  3. Write a program that inputs 3 integers, print the sum, product, and average of these integers.

    ReplyDelete

Post a Comment

Popular posts from this blog

VACATION HOMEWORK

Dashain Vacation homework