Nemal Codes
Nemal Codes
MS SMALL BASIC
Code to find out if a number is
divisible by 3
TextWindow.WriteLine("Enter a number")
number = TextWindow.ReadNumber()
x = Math.Remainder(number, 3)
If (x = 0) Then
Else
EndIf
Percentage of attendance
i = 0
While i > -1
TextWindow.WriteLine ("How many days were in that month?")
D = TextWindow.ReadNumber ()
TextWindow.WriteLine ("How many days did you come to school in
that month")
A = TextWindow.ReadNumber()
P = A/D * 100
TextWindow.WriteLine ("The percentange of the student coming
to school in a particular month is " + P)
TextWindow.WriteLine ("If you don't want to continue enter -1
else enter any other number")
i = TextWindow.ReadNumber()
EndWhile
Change F to Celsius
TextWindow.WriteLine ("Enter the upper limit of the temeperature in F")
upperlimit = TextWindow.ReadNumber() TextWindow.WriteLine ("Enter the lower
limit of the temperature in F") lowerlimit = TextWindow.ReadNumber()
TextWindow.WriteLine ("Fahrenheit" + " " + "Celsius") For Fahrenheit = lowerlimit
To upperlimit Celsius = (Fahrenheit - 32) * 5/9 TextWindow.WriteLine (Fahrenheit
+ " " + Celsius) EndFo
Visual Basic
How to find the net amount
Public Class Form1
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
End Sub
End Sub
End Sub
End Class
Convert F to C
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox2.Text = (Val(TextBox1.Text) - 32) * 5 / 9
End Sub
End Class
else :
if number % 2 == 0 :
else :
if number % 7 == 0 :
else :
if number % 5 == 0 :
print ("Hello")
else :
print ("Bye")
unit = int(input("Enter the units you have used the electricity for :"))
price = 0
price = unit * 0
print (price)
marks = int(input("Enter your marks : "))
if marks > 90 :
grade = "A"
grade = "B"
grade = "C"
else :
grade = "D"
print(grade)
while x <= 5 :
print (x)
x += 1
print (i)
Code to use range by printing
numbers in backwards from 10
to 3 decreasing in 2s
for i in range (10,2,-2)
print (i)
print(fruit)
print(fruits)
print(fruits [:3] )
print (i)
i=i+1
multiplier = 1
multiplier = multiplier + 1
print (result)
multiplier = multiplier + 1
print (result)
Write a program that asks the
length of a square and prints its
area
length = int(input("Enter the length of a square : "))
while nnumber == 1:
multiplier = 1
print (result)
multiplier = multiplier + 1
nnumber = int(input("Do you want to find the multiples of another number; If yes, press 1"))
jinput = int(input( "If you want to add the numbers, press on one. \nIf you want to subtract the
numbers, press two.\nIf you want to multiply the numbers, press three. \nIf you want to divide the
numbers, press four." ))
if jinput==1 :
result = x + y
elif jinput == 2 :
result = x - y
elif jinput == 3 :
result = x/y
elif jinput == 4:
result = x * y
else :
nnumber : int(input("Do you want to continue using other numbers? If yes, press 5"))
total += 1
print (total)
total = 0
total += visits
print (total)
print (total)
A BETTER VERSION
print("B I R D V I S I T O R S")
print ("Count the number of visits to the feeder. Time yourself.\n At the end of each minute, enter
the number. \n When you type -1, the program will stop. \n \n ")
total = 0
total += visits
print ("Count the number of visits to the feeder. Time yourself.\n At the end of each minute, enter
the number. \n When you type -1, the program will stop. \n \n ")
total = 0
counter = 0
total += visits
print ("The total number total number of visits are : ", total)
average = total/counter