Posts

Showing posts with the label if and if-else statements in the C programming language

How To Write Hello World Program In C++ Programming Language

Image
  How To Write a Hello World Program In C++ Programming Language In this post we will look at how a C++ program works. We will try make the example as simple as possible for the beginners so they can easily understand the basics of C++. We will write a simple C++ hello world program in C++ programming language which is considered as the very first program in almost every programming language. A Brief Introduction to the C++ Programming Language C++ is an object oriented programming language and it is an extension to C programming language. C++ is a general purpose programming language and it is also a case-sensitive language. C++ is very powerful programming language it has features of both low level and high level programming languages, and that is why it is called mid level programming language. Hello World program in C++ programming language Above is an example of a simple Hello World program in C++ programming language. Now let us look at the code, and I will take you...

if and if-else statement in C programming language

Image
  If and if-else statements in the C programming language When we start writing a program, if the program is simple, like adding two numbers, or a Hello World program, we don't need any decision-making in such programs.  But as the programs get complicated, they become complex, and we must make decisions. For such programs, we use conditional statements, which help in making decisions. One of the most important conditional statements is 1) if statement 2) if-else statement What is the if condition? It is a conditional statement used in almost every programming language. The if statement executes a piece of code based on a specific condition when it is true. When the condition is true, it executes the code with curly brackets. What is the syntax of if statement  The if statement has a very simple syntax, as shown below if (condition) { //This piece of code will run if the given condition is true } the above line of code tells us that when the conditio...