Press "Enter" to skip to content

C – Else-If , Continue , Break Expressions

In this essay , I will talk about the else-if , continue and break expressions. These expressions helps us to write easily code.

Else-if help us the add another condition to if – else. Like i will make program which is about the letter grade. If your note bigger or equal to 90 and smaller than 100 , your letter grade AA. In here , using with the else if i will add another condition. If your note bigger or equal to 80 and smaller than 90, your letter grade is BB. If your note bigger or equal to 70 and smaller than 80, your letter grade CC . If your note bigger or equal to 60 and smaller than 70 , your letter grade is DD . If your note smaller than 60, your letter grade is FF. I think if you look code syntax , you will understand better.

Screen Output;

Now , I will make programs about the continue and break phrases. Continue means dont read the after the continue phrases. When the program see continue phrase , jump the code syntax . Break means is finish the program . I mean , When the program see break phrase , program will be finish there. When you see the code syntax , you will understand better also you should write these code yourself.

First , I will make program about break . Program will take the number from the user and program will add 10 to the user’s number . When the user wanna finish program , user will press the -1. Break help us to finish program when we press -1.

Screen Output;

Finally , I will make a program about the continue. Program will take numbers from user  and will collect each other.If the sum divide by 3 without remaining , program won’t collect each other. I will do this using with the continue.

 

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *