What is C Programming
C++ is a powerful general-purpose programming language. It can be used to develop operating systems, browsers, games, and so on. C++ supports different ways of programming like procedural, object-oriented, functional, and so on. This makes C++ powerful as well as flexible.
Why Learn C++
-C++ is used to develop games, desktop apps, operating systems, browsers, and so on because of its performance.
-After learning C++, it will be much easier to learn other programming languages like Java, Python, etc.
-C++ helps you to understand the internal architecture of a computer, how computer stores and retrieves information.
If and else statements in C Programming
It is highly probable that you have seen these before, probably with slightly different symbols. They should not present any hindrance to understanding. Now that you understand TRUE and FALSE well as the comparison operators, let us look at the actual structure of if statements.
Basic if Syntax
The Structures of an if statment is as follows
If(statement is true){
Execute this is Line of Code
}
Here is a simple example that shows that syntax:
if(score>=50)
{
printf("Pass\n");
goto input;
}
Else
The Structures of an if and else statment is as follows
If(statement is true){
Execute this is Line of Code
}
else
{
Execute this is Line of Code
}
Here is a simple example that shows that syntax
if(score>=50)
{
printf("Pass\n");
goto input;
}
else
{
printf("Fall\n");
goto input;
}
Sometimes when the condition in an if statement evaluates to false, it would be nice to execute some code instead of the code executed when the statement evaluates to true. The "else" statement effectively says that whatever code after it (whether a single line or code between brackets) is executed if the if statement is FALSE.
Example
#include <stdio.h>
#include <conio.h>
int main()
{
if(score>=50)
{
printf("Pass\n");
goto input;
}
else
{
printf("Fall\n");
goto input;
}
getch();
}
Please Watching My Video is Below
No comments:
Post a Comment