Thursday, December 19, 2013

Small basic

TextWindow.WriteLine("Sain bn uu ?")



TextWindow.Title = "Medeelel zui VI“
TextWindow.ForegroundColor = "Green"
TextWindow.Write("6 dugaar bvleg : ")
TextWindow.WriteLine("Algorithm, programmchlal")





TextWindow.Write("Neree oruulna uu?")
ner = TextWindow.Read()
TextWindow.WriteLine("Sain bn uu? " + ner + "?")




a=5
b=10
nillber = a+b
TextWindow.WriteLine("Nillber: " +nillber)TextWindow.Write("a= ")





a = TextWindow.ReadNumber()
TextWindow.Write("b= ")
b = TextWindow.ReadNumber()
niilber = a + b
TextWindow.WriteLine("Nillber: " + niilber)



Нөхцөл шалгах оператор



TextWindow.Write("Too oruul: ")
a = TextWindow.ReadNumber()
uldegdel = Math.Remainder(a, 2)
If(uldegdel = 0) Then
  TextWindow.WriteLine("Tegsh too")
Else
  TextWindow.WriteLine("Sondgoi too")
EndIf





TextWindow.Write("a too oruul: ")
a = TextWindow.ReadNumber()
TextWindow.Write("b too oruul: ")
b = TextWindow.ReadNumber()
TextWindow.Write("c too oruul: ")
c = TextWindow.ReadNumber()
If (a+b>c) And (a+c>b) And (b+c>a) Then
  TextWindow.ForegroundColor = "Green"
  TextWindow.WriteLine(a + "," + b + "," + c + " taltai gurwaljin orshin bn")
Else
  TextWindow.ForegroundColor = "Red"
  TextWindow.WriteLine(a + "," + b + "," + c + " taltai gurwaljin orshin baihgvi")
EndIf




s = Math.SquareRoot(a)




давтал




n = TextWindow.ReadNumber()
For i = 1 To n
  TextWindow.WriteLine(i)
EndFor





n = TextWindow.ReadNumber()
For i = 1 To n
  TextWindow.Write(i)
EndFor





n = TextWindow.ReadNumber()
s=0
For i = 5 To n Step 5
  s=s+i
EndFor
TextWindow.WriteLine("Niilber: " + s)





Нөхцөлт давталт


TextWindow.Write("n= ")
n = TextWindow.ReadNumber()
m=n
s=0
While m <> 0
  s = s + Math.Remainder(m, 10)
  t=m/10
  m = Math.Floor(t)
EndWhile
TextWindow.WriteLine(n + " toonii tsipruudiin niilber: " + s)

No comments:

Post a Comment