Posts

recursive function in c

  #include <stdio.h> int   factorial  ( int   number ) { if  (  number  ==  0  ||  number  == 1 )      return   1 ;      else               return  (  number  *  factorial  (  number  - 1 ));           } int   main ( int   argc ,  char   const  * argv [] ) {        int   num ;           printf ( " enter the num you want to print factorial  \n " );      scanf ( "%d" ,& num );      printf ( " the factorial of %d is %d " ,  num  ,  factorial ( num ));      return   0 ; } The process in which a ...

functuion in c language

  Functions : Functions are used to divide a large C program into smaller pieces. Function can be called multiple or several times to provide reusability and modularity to the C program. Functions are also called as procedure or subroutines. It is a piece of code to accomplish certain operation Advantages of Functions : We can avoid rewriting same logic or code through functions. We can divide the work among programmers using functions. We can easily debug or can find bugs in any program using functions. Function Aspects : There are 3 aspects of function :- Declaration Definition Call  there two type of function  1. library function 2. user define function  in this all doubt is clear  #include <stdio.h> int   sum  (  int   a  ,  int   b ) {     return   a + b ; } int   printstar (  int   n  )      {     char   i ;      ...

Loops in c language for , while , do while loop in c programing

 Loop-  for loop- #include <stdio.h> int   main ( int   argc ,  char   const  * argv [] ) {     /* int ch;     for ( ch = 'A'; ch <= 'Z'; ch++)     {         printf("%c\n",ch);     }*/     /* int no , i;     printf(" enter any number\n");     scanf("%d\n",&no);     for ( i = 1; i <= 15; i++)     {         printf("%d\n", i*no);     }     */      /*    int i;    for ( i = 10; i <= 60; i=i+3  )    {  ...

Switch case statemant in c

  #include <stdio.h> int   main ( int   argc ,  char   const  * argv [] ) {     /* int age , mark;       printf(" enter your age\n");       scanf("%d", &age);       printf(" enter your mark\n");       scanf(" %d",&mark);       switch (age)       {       case 3:           printf(" YOUR AGE IS 3\n");                      switch (mark)           {           case 50:   ...

If Else Control Statements In C

  If Else Control Statements In C:  #include <stdio.h> int   main ( int   argc ,  char   const  * argv [] ) {        /* int age;     printf(" hello ");     printf(" enter your age\n");     scanf(" %d", &age);     printf(" you have enterd yoour age is %d \n", age);          if (age>18)     {         printf(" you can vote");     }          else if (age>=10)     {         printf(" you can vote for babies");     }        ...

what is Format specifier in C

  Format specifier in C:- Format Specifier Type %c Used to print the character %d Used to print the signed integer %f Used to print the float values %i Used to print the unsigned integer %l Used to long integer %lf Used to print the double integer %lu Used to print the unsigned int or unsigned long integer %s Used to print the String %u Used to print the unsigned integer

Operator and operand , what is Operator and operand

x+y + is a operater and xy is a operand  Operator It is a special symbol which is used to perform logical or mathematical operation on data or variable. Operand It is a data or variable on which the operation is to be performed. Types of Operator ⇒Arithmetic Operators ⇒Relational Operators ⇒Logical Operators ⇒Assignment Operators ⇒Bitwise Operators ⇒Increment/Decrement Operators ⇒Conditional Operators ⇒Special Operator Arithmetic operators: Operator Description + Addition − Subtraction * Multiplication / Division           % Modulus int a = 2 ; int b = 3 ; printf ( "a + b = %d\n" , a + b ) ; Relational Operators: Operator Description >  Greater than <  Less than >= Greater than or equal to <= Less than or equal to == Is equal to != Is not equal to int a = 2 ; int b = 2 ; printf ( "a == b = %d\n" , a == b ) ; Logical Operators: Symbol Operator && AND operator || OR Operator ! NOT O...