Write a program in QBASIC to enter a number and check whether the number is prime or not
PLS I NEED TO SUBMIT MY WORKSHEET I DINT KNOW THIS ANSWER
Answers
Answered by
0
Answer:
bxudhfbd dbdkdkdbdls
zjsidldkdishheowpwm
hsjsksbfuejwpqpkd
sjsjdkrojrowlahuele
jskeppejhsuwknjjeiowlw
jskekrjjdipqllbshienrhjsjsjje
jsjdjrbwllsbhdkwnusoebyale
hsjsklenahjrbdghrbdl
hdjrjrldojsgailrldjenidkelwje
hsjejbridbcyhsjxtfshkelqken
hsjehehikbagiwlrbsilamdjsp
Answered by
0
Program:
Dim n As Integer
Dim i As Integer
Dim flag As Integer
Cls
Input "Enter a number : ", n
flag = 0
For i = 2 To n - 1
If n Mod i = 0 Then
flag = 1
End If
Next i
If flag = 0 Then
Print "Prime number"
Else
Print "Not a prime number"
End If
End
Output 1:
Enter a number : 101
Prime number
Output 2:
Enter a number : 34
Not a prime number
Similar questions
Social Sciences,
1 month ago
Accountancy,
1 month ago
Social Sciences,
3 months ago
English,
10 months ago