Basic programming course: Lesson #4 Control structures. Part 1. Conditionals.

in devjr-s20w4 •  last month 

Assalam-o-Alaikum!!!

Greetings to my all STEEMIT fellows. Hopefully, you all are fine and enjoying your best life on STEEMIT. I am also fine ALHAMDULILLAH. Today I am going to take part in this engagement challenge which is organized by @alejos7ven. And I am very thankful

image.png

Describe your understanding of conditional structures and mention 2 situations of everyday life where you could apply this concept

Conditional frameworks are programming constructs that allow decisions to be made based on certain conditions. These statements typically follow an if-then logic: if a condition is true, a block of code is executed; otherwise, An else operation may or may not occur. In more complex scenarios, additional conditions can be tested using the Else condition.

1. Deciding Whether to Take an Umbrella

As we all know that there is very hot today. So it has to be decdide that we have to take umbrealla in sunsuine or not

  • If it is goint to sunshine , then go to umbrella

  • Else Dont take one

2.Setting Alarm at the time of FAJAR PRAYER:

  • If it is time of Fajar Prayer, then SET_ALARM at 4:30 AM
  • Else Turn it off
Create a program that tells the user "Welcome to the room What do you want to do?", if the user writes 1 then it shows a message that says "you have turned on the light", if the user writes 2 then it shows a message that says "you have left the room". Use conditionals.

Here I will show you the program in which I i write 1 then it will show that you turned on the light. And If I will type 2 , then It will show you have left the room. And I will use it by using conditions. That is very necessary. Because condition is very necessary in this program

image.png

HERE I will enter the number 1, then the out put will be:

image.png

And if the entered number will be 2, then it will show you have left the room

image.png

Create a program that asks the user for 4 different ratings, calculate the average and if it is greater than 70 it shows a message saying that the section passed, if not, it shows a message saying that the section can improve

In this program, we will show 4 numbers that will be on rating. And I will show you the average rating. And then according to the code. it will show that if then average rating will be less then 70 then It will show section can improve. . And then If the average rating will be greater then 70 then it will show section will be passed

image.png
Now I will show you the out put in this the average rating is less then 70 , the out put will be section can improve

image.png

And now there is out put where it will show that if average rating will be greater than 70, The out put will be Section passed

image.png

So here I completed my all tasks. And I tried my best. I hope you will like my post

Special Thanks to @alejos7ven

Invite Friends: @ruthjoe , @abdullahw2, @memamun

Regards:@arinaz08

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...
Loading...