Unlike most of the computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given boolean condition in C or C++. The while loop can be thought of as a repeating if statement. Here is some program using while Loop: Continue reading
Unlike any programming, language loops play a very important role in C or C++ . Here is some example program using for loop. Continue reading
Well, friends today we discuss about loops in C /C++. Iteration statements (Loops) allow a set of instruction to be executed repeatedly until a certain condition meets. The condition may be predefined or open ended like (for loop and do-while or while loop) Continue reading
C/C++ supports two types of selection statements: if and switch. In addition, the ? operator is an alternative to if in certain circumstances for flow control.
The Syntax of if statement is
if (expression) statement;
else statement; Continue reading
GCD: The greatest common divisor (GCD), which is also known as the greatest common factor (GCF), of two or more integers, is the largest integer that is a common divisor (factor) of all the given integers.
LCM: The least common multiple (LCM), which is also known as the least common denominator (LCD) in fractions, of two or more integers is the smallest integer that is a common multiple (denominator) of all the given integers. Continue reading
C program to check odd or even: In childhood As you have studied in mathematics that in decimal number system even numbers are divisible by 2 while odd are not divisible by 2, we may use modulus operator(%) which returns remainder, For example, 7%2 gives 1 ( remainder when seven is divided by two). Even numbers are of the form 2*X and odd are of the form (2*X+1) where X is is an integer.We will determine whether a number is odd or even by using different methods all are provided with a code in c language.
C program to perform basic arithmetic operations which are an addition, subtraction, multiplication, and division of two numbers. Numbers are assumed to be integers and will be entered by the user.
Write a c program that takes two or more numbers from the user then print the sum of these number.
This c language program performs the basic arithmetic operation of addition on two numbers and then prints the sum on the screen. For example, if the user entered two numbers as 2, 4 then 6 (2 + 4) will be printed on the screen. Continue reading
Let’s talk about integers. Whole numbers less than zero are called negative integers. The integer zero is neither positive nor negative and has no sign. Two integers are opposites if they are each the same distance away from zero but on opposite sides of the number line. Positive integers can be written with or without a sign. Besides that, an integer without any sign is called Unsigned integer.
int data type is signed and has a minimum range of at least -32767 through 32767 inclusive. The actual values are given in
unsigned int has a minimal range of 0 through 65535 inclusive with the actual maximum value being
UINT_MAX from that same header file.
C program print integer
Data types in c give you abilities to choose exact data type of variable for your operation. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.