Skip to content

Commit

Permalink
C/C++ codes
Browse files Browse the repository at this point in the history
  • Loading branch information
fazelelham32 authored Aug 31, 2024
1 parent dc110d6 commit 5dab18a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions prog4_1.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
If (Clock.Hour<12) Then
TextWindow.WriteLine("Good Morning World!")
TextWindow.WriteLine("Did you have breakfast?")
EndIf

If (Clock.Hour>=12) Then
TextWindow.WriteLine("Good Evening World!")
TextWindow.WriteLine("Did you have lunch?")
EndIf
7 changes: 7 additions & 0 deletions prog4_2.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
If (Clock.Hour<12) Then
TextWindow.WriteLine("Good Morning World!")
TextWindow.WriteLine("Did you have breakfast?")
Else
TextWindow.WriteLine("Good Evening World!")
TextWindow.WriteLine("Did you have lunch?")
EndIf
8 changes: 8 additions & 0 deletions prog4_3.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TextWindow.Write("Enter a number: ")
n = TextWindow.ReadNumber()

If (Math.Remainder(n,2)=0) Then
TextWindow.WriteLine("The number is Even.")
Else
TextWindow.WriteLine("The number is Odd.")
EndIf
15 changes: 15 additions & 0 deletions prog4_4.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TextWindow.WriteLine("This program calculates BMI.")
TextWindow.WriteLine("")

TextWindow.Write("Please enter your weight in KiloGrams (kg): ")
W = TextWindow.ReadNumber()

TextWindow.Write("Please enter your height in Meters (m): ")
H = TextWindow.ReadNumber()

BMI = W/(H*H)

TextWindow.WriteLine("")
TextWindow.WriteLine("Your BMI = " + BMI)
TextWindow.WriteLine("")

0 comments on commit 5dab18a

Please sign in to comment.