Skip to main content

Posts

Showing posts from April, 2020
To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

Continue Statement-:

continue is a keyword.The continue statement can only be use within loop.On execution it transfers the control to the beginning of the loop, Thus ignoring the execution of all other statement written below it within the loop. A continue statement should always be dependent upon the condition. Syntax of continue statement in for loop -: for( _ ; _ ;_ )     {     _            _        if(condition)             continue;        else               _               _         } Example  of continue statement in for loop   -: ads #include<stdio.h> #include<conio.h> main() { int i=1;    for(i=1;i<=5;i++)  { if(i==3)     continue;      else      printf(" %d \n ",i);   }      getch();   }     Output-:  1                      2                      4                      5 Syntax of continue statement in while loop -: while(condition)     {     _            _        if(condition)           continue;        else               _      

Break Statement-:

1- break is a keyword. 2- The break statement is used within a loop or switch statement on execution,it transfer the control outside the loop or switch statement within which it is enclosed. 3- The break statement should always be dependent upon a condition. ads Syntax of break statement in for loop -: for( _ ; _ ;_ )     {     _            _        if(condition)             break;        else               _               _        } Example  of break statement in for loop   -: #include<stdio.h> #include<conio.h> main() { int i=1;    for(i=1;i<=5;i++) { if(i==3)    break;    else    printf(" %d \n ",i);  }    getch();   }     Output-:  1                      2 Syntax of break statement in while loop -: while(condition)     {     _            _        if(condition)             break;        else               _               _         } Example  of break statement in while loop   -: #include<stdio.h> #inc

do-while loop-:

do-while is a condition control loop.The do-while loop is used to carry out looping operation,in which a statement or group of statements is/are executed repetitively until some logical condition has been satisfied. do-while is also called "exit-control loop" ,because in do-while loop first the statement get executed and then the condition is checked,hence the do-while always execute at least one's. In the do-while loop, there must be at least one such statement within the body of loop which changes the looping condition,during the execution of loop otherwise an infinite loop may occur. ads Syntax -: do     statement;     while(condition); or, do    {statement-1;      statement-2;      -      -      statement-n;      }while(condition); Example -: Write a program to find sum of series of terms: 2+4+6+8+ - - -n #include<stdio.h> #include<conio.h> main() {int i=1,term=0,s=0;   printf("Enter the term");   scanf("%d&q

While Loop-:

While loop is a condition control loop.The while loop is used to carry out looping operation.In while loop,a statement or a group of statements is/are executed repetitively until some condition has been satisfied.There must be at least one such statement within the body of loop which changes the looping condition during the execution of loop,otherwise an infinite loop may occur.While loop is also called "Entry-Control Loop" because in while loop first the condition is checked and then the statement  get executed. ads Syntax -: while(condition)     statement; or, while(condition) {statement-1;  statement-2;  -  -  statement-n; } Example -:                ads Write a program to find sum of series of terms: 1+3+5+ - - -n. #include<stdio.h> #include<conio.h> main() { int term=0,i=1,s=0;    printf("Enter the number of term");    scanf("%d ",&term);     while(i<=term)    {s=s+(2*i-1);           i++;     }  

for loop-:

for loop is a counter controlled loop,perhaps the most commonly used looping statement in C programming. It is used to repeatedly execute either a single or a group of statement for a finite number of times. Syntax -: for( I nitialization ;Testing; I ncrement/Decrement )                                                                       ads Initialization-: This expression is used to initialize same parameter [called an index],that control the looping action. Testing Expression-: It represent a condition that must be TRUE for the loop to continue its execution. I ncrement/Decrement Expression-: It is a unary expression or an assignment expression.It increment or decrement the index so that the loop continue. Example -: #include<stdio.h> #include<conio.h> main() { int i=0;    for(i=1;i<=5;i++)    printf("\n %d",i);    getch(); } Output -: 1                 2                 3                 4                 5 Exa

Loops/iteration-:

Loops or iteration are mostly use in C programs. sometimes a program may require that a group of instruction executed repeatedly either for a finite number of times or until some logical condition has been satisfied,this is known as looping. Loops are used to repeat the execution of  a statement or a set of statement,depending on the value of  an integer expression. There are two categories of Loops-: 1- Counter Controlled Loop -:   These are the loops in which the number of repetition are finitely fixed. for loop CLICK HERE 2- Condition Controlled Loop -: These are the loops in which number of repetition are not fixed. ads while loop   CLICK HERE do-while loop     CLICK HERE ads Watch The Video Below 

Switch Statement-:

A Switch case statement is a multi way decision statement, that is a simplified version of if-else block,switch statement are mostly used in two situation-: 1- When there is only one variable to evaluate in the expression. 2- When many condition are being tested for when there are many condition to test, using the "if " and " if-else " construct becomes a bit complicated and confusing,therefore switch case statement are often used as alternative to long if statement. ads The switch case expression is either an integer or character type.If the value of switch expression matches any of the constant case, the relevant code is executed and control moves out of the switch case statement.If the expression does not matches any of the constant case,then the default statement is executed.        In switch statement case and default are keyword or reserved words. Every case statement terminates with colon(;). The break statementis used to exit from current case

if-else-if Ladder-:

C language support if-else-if   statement to test additional condition apart from the initial text expression.In this kind of statement numbers of logical statement is checked for executing various statement,if any logical statement is TRUE then compiler executes the block followed by if condition otherwise it skipes and execute else block. ads Syntax -: if (condition-1) statement-1; else if (condition-2) statement-2; else if (condition-3) statement-3; else statement-4; } Example -: #include<stdio.h> #include<conio.h> main() {char ch;    printf("Enter any character");    scanf("%c",&ch);     if (ch>=65)&&(ch<=90)    printf("%c is an alphabet in uppercase",ch);    else if (ch>=97)&&(ch<=122)    printf("%c is an alphabet in lower case",ch);    else if (ch>=48)&&(ch<=57)    printf("%c is a digit",ch);    else    printf("%c is a special symbol&q

Nested if-:

Nested of 'if ' means one ' if '  is enclosed with in another ' if '.  In nested if , every ' if '  have an else statement.   Syntax -: if(condition)   if(condition)   statement-1;   else   statement-2; else statement-3; } ads Example -: #include<stdio.h> #include<conio.h> main() { int a=0,b=0,c=0;    printf("Enter the value of a,b,c);    scanf("%d %d %d",&a,&b,&c);    if(a>b)      {if(a>c)      printf("\n %d is largest",a);      else      printf("\n %d is largest",c);      } else if(b>c)  printf("\n %d is largest",b); else printf("\n %d is largest",c); getch(); } output -: Enter the value of a,b,c 10                15                 22                22 is largest ads Watch The Video Below

if-else Statement-:

if-else statement is a conditional statement which allows us to select and execute one statement or a group of statement out of two available statements or group of statements depending upon the truthfulness of a condition. ads Syntax -:  if(condition) statement-1; else statement-2; or, if(condition); { statement-1;   statement-2;   statement-3;     -     -     -   statement-n; } else {statement-1;    -    -    - statement-n; } ads Example -: #include<stdio.h> #include<conio.h> main() {int num=0; printf("Enter the value of num"); scanf("%d",&num); if(num%2==0) printf("\n Even number"); else printf("\n odd number); getch(); } output-:Enter the value of num 15                odd number Watch The Video Below

if-Statement-:

The if statement is simplest form of decision control statement i.e. frequently used in decision making.The syntax of if statement is as follow-: syntax -: if(condition)                statement; or if(condition) {statement-1;   statement-2;   statement-3;    -    -    -    statement-n; } From above syntax if the condition is TRUE,then the statement will execute or a block of statement-1 to statement-n will execute. ads Example -: #include<stdio.h> #include<conio.h> main() {int num=0;   printf("Enter The Value of num");   scanf("%d",&num);   if(num%2==0)   printf("\n %d is an  Even Number",num);   getch(); } output -:Enter The Value of num 30               30 is an Even Number ads Watch The Video Below

Control Structure-:

Decision Control Statements We know that the code in C programming executed sequentially from the first line of the program to its last line.In some case we want only selected statements,to be executed,this can be done through decision control statement also called conditional branching statement. The decision control statement are as follow-: (a-) if statement  CLICK HERE (b-) if-else statement CLICK HERE (c-) Nested if  CLICK HERE (d-) if-else ladder CLICK HERE (e-) switch statement CLICK HERE ads Watch The Video Below   

First Program in C-:

#include< stdio.h > #include< conio.h > main() {printf(" My First  C program "); getch(); } output -: My First   C program In above program the first character is #, it is known as C pre-processor,to get more about pre-processor CLICK HERE. Then there are two header files " stdio.h " and " conio.h ",to learn more about header files CLICK HERE. ads N ow there is main ()  function  it is the entry point of any  C  program. It is the point at which execution of program is started. When a  C  program is executed, the execution control goes directly to the  main ()  function . Every  C  program must have a  main ()  function. printf() is used to display message or the data stored in any variable on console. getch() is used to hold the console screen. The black screen,where we see output,that screen is hold by getch() function. To compile program press Alt+F9 and to run program press Ctrl+F9. ads Watch The

Header Files-:

Header Files •A header file is a file with extension  [.h ]  which contains C function declarations and macro      definitions to be shared between several source files. •There are two types of header files: the files that the programmer writes and the files that comes with your compiler. •Commonly used are:stdio.h,conio.h, math.h, stdlib.h, float.h etc. ads Most Common Header files Used in the C program and there functions are as follow-: List of inbuilt C functions in stdio.h file:- printf()-:  This function is used to print the character, string, float, integer, octal and hexadecimal values onto the output screen scanf()-:  This function is used to read a character, string, numeric data from keyboard. getc()-:  It reads character from file gets()-:  It reads line from keyboard getchar()-:  It reads character from keyboard puts()-:  It writes line to o/p screen putchar()-:  It writes a character to screen clearerr()-:  This function clears the error indicators

C Pre-processor-:

C Pre-processor   1- Macro Pre-processor 2- Represented with # 3- Provides the ability for the inclusion of header files, macro expansions, conditional compilation. 4- Pre-processing is a program which performs before compilation.It only notice statement which    starts with # . 5- The work of pre-processor is that,it link the function body which are used in the program,under a header file. For Example -:  The pre-processor replaces the line #include<stdio.h> with the text of the file 'stdio.h',which declares printf() function. ads Watch The Video Below

Bit-wise Operator-:

C has the special feature to manipulate with bits,in some application we require manipulation on bits such as system programming. C has bit-wise operator to support bit-wise operation ,possible bit-wise operator available in C are as follow-: (a-) Once Complement -: This operator is denoted as  " ~ " [tilde] . This operator is unary in nature, i.e. it require single operand to perform an operation.It is one of the method used for data encryption. It works on binary pattern and convert all the one's into zero and zero's into one. Example -: consider the following bit pattern:-                       110101001 Hence,its once complement will be 001010110. (b-) Bit-wise Left Shift -: This operator is denoted as " << " . This operator is binary in nature,i.e. it require two operands to perform an operation.The left operand is variable and right operand is in binary pattern,the bits are shifted to left and for each bit shifted ,a zero is added to th

Increment and Decrement Operator-:

  Increment and Decrement Operator  are unary in nature i.e. it require single operand to perform an operation.Increment operator is represented by "++" while decrement operator is represented by "--".     I ncrement -:   Pre increment     [ ++i ]                         Post increment     [ i++ ]   Decrement -:   Pre decrement      [ -- i ]                         Post decrement      [ i -- ] Increment operator increments the value of operands by 1 while decrement operator decrements the value of an operands by 1.                                                                                                                        ads Example -:  Increment operator:-       #include <stdio.h> #include <conio.h> void  main () { int  x , i ; i = 10 ; x =++ i + i++ ; printf ( "x: %d" , x ); printf ( "i: %d" , i ); getch (); }          o utput-:  i=12    

Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey