Loops are very important concept in C language and any other programming language. Loops are important to convert the larger program to smaller ones. Loops are 'the sequence of statement which continues to execute until the desired condition is met.' There are 3 types of loops in C language : 1. for loop. 2. while loop. 3. do while loop. 1. for loop The syntax of for loop is " for(initialization;expression;increment/decrement)". For loop is also called as entry controlled loop , where we initialize statement, give condition, and update statement in a single line. The for loop statement will be executed until the condition evaluation is true. Whenever the condition fails the control skip the for loop. Flowchart of for loop. Simple program to print number from 1 to 10 using 'for loop'. #include <stdio.h> void main() { int i; for(i=0...
Arithmetic operations are addition, subtraction, multiplication ,division and modulus. All these operations can be performed in the C programming using arithmetic operators. Arithmetic operators are ( + , - , * , / ,%).Using these operators we can perform different types of operations. Program To add two numbers. #include <stdio.h> int main() { int a,b,c; printf("Enter the value of a :"); scanf("%d",&a); printf("Enter the value of b :"); scanf("%d",&b); c=a+b; printf("Addition of a and b is %d.",c); return 0; } Output : Enter the value of a :5 Enter the value of b :2 Addition of a and b is 7. In these program the first line "#include <stdio.h>" is the header file which is used for basic input and output in the program."int main()" here ...