Category: C Language
FOR Loop in C Language: (1) The FOR statement is used to iterate over a range of values or a sequence. The FOR loop is executed for each of the items in the range. (2) Sample C language code and its output, as shown. #include <stdio.h>#include <conio.h>//Table of 2 using for loopint main(){ int x; int …
SWITCH Statement in C Language: (1) SWITCH Statement successively tests the value of an expression against a list of integer or character constants. When a match is found, the statements associated with that constant are executed. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>int main(){ int x; x = 2;switch(x) { …
If Else condition in C Language: (1) If Else statement allows us to write two alternative paths and the control condition determines which path gets executed. In an if-else statement, only the code associated with if (i.e. statement-1) or the code associated with else (i.e. statement-2) executes, never both. (2) Sample C language code and its …
Logical Operators in C Language: (1) Logical Operators are used for assigning values to variables. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>// Logical Operators in C Languageintmain(){int x;int y;x = 5; y = 7; // Returns 1printf(“Return Value: %d\n”, x > 3 && x < 10); // Returns 0printf(“Return Value: …
Comparison Operators in C Language: (1) Comparison Operators are used for comparing two variables. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>// Assignment Operators in C Languageint main(){int x;int y; x = 5; y = 5;printf(“x equals to y: %d\n”, x == y); x = 5; y = 6;printf(“x not equals …
Arithmetic Operators in C Language: (1) Arithmetic Operators are used for calculation purpose. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>// Arithmetics Operators in C Languageint main(){ int x; int y; x = 10; y = 2; printf(“Value of Addition is: %d\n”, x+y); printf(“Value of Subtraction is: %d\n”, x-y); printf(“Value of …
Variables in C Language: (1) In C language when we develop or built logic, we need variables that store information like amount, string or character. For storing this type of information, the C language provides variables like int, float, and char. (2) Sample C language code using all variables and their output, as shown: #include <stdio.h>#include …
scanf() Use in C Language: (1) scanf() is used for entering input values. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h> int main(){int n;printf(“Enter the value: “);scanf(“%d”,&n);printf(“Entered value is: %d”, n);getch();return 0;} (3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown. (4) …
Use printf() in C Language: (1) printf() is used for printing output value. (2) Sample C language code and its output, as shown: #include <stdio.h>#include <conio.h>int main(){printf(“My First C Programme”);getch();return 0;} (3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown. (4) After building the code, press …
C Language Syntax: (1) C Language is designed by “Dennis Ritchie”. (2) C Language is a procedural programming language. (3) C Language is designed to be compiled to provide low access to memory. (4) For learning the C language, first install the editor and compiler. For this, refer to the blog “Install Code Blocks for C …