Wednesday, April 22, 2020

Program without using conio.h in C

  • Program :

#include<stdio.h>
int main()
{
int a = 5, b = 10, sum;
        printf("\n----------------WITHOUT USING <CONIO.H>----------------");
sum = a + b;
printf("sum = %d\n",sum);
return 0;
}


Usage of isdigit() in C

  • Program :
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main() {
   char val1 = 's';
   char val2 = '8';
   clrscr();
   printf("\n----------------USAGE OF ISDIGIT()----------------"); 
   if(isdigit(val1))
      printf("The character is a digit\n");
   else
      printf("The character is not a digit\n");
 
   if(isdigit(val2))
      printf("The character is a digit\n");
   else
      printf("The character is not a digit");
 
   getch();
}


Usage of isalpha() in C

  • Program :

#include<stdio.h>
#include<conio.h>
#include<ctype.h>
void main() {
   char val1 = 's';
   char val2 = '8';
   clrscr();
   printf("\n----------------USAGE OF ISALPHA()----------------");
   if(isalpha(val1))
      printf("The character is an alphabet\n");
   else
      printf("The character is not an alphabet\n");
 
   if(isalpha(val2))
      printf("The character is an alphabet\n");
   else
      printf("The character is not an alphabet");
 
   getch();
}

Managing I/O operations in C

  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
char ip;
clrscr();
printf("\n----------------MANAGING I/O OPERATIONS----------------");
//prompt for character and get input.
printf("Type a character and press enter.n");
ip = fgetc(stdin);
//write input value back out to standard out.
fputc(ip, stdout);
printf("n");
getch();
}


File management in C


  • Program :

#include<stdio.h>
int main()
{
    FILE *f1;
    char c;
    printf("\n----------------FILE MANAGEMENT----------------");
    printf("\nData Input");
    f1=fopen("Input","w");
    while((c=getchar())!=EOF)
    putc(c,f1);
    fclose(f1);
    printf("\nData Output");
    f1=fopen("Input","r");
    while((c=getc(f1))!=EOF)
    printf("\n%c",c);
    fclose(f1);
}


Pointers in C

  • Flowchart :


  • Syntax :
type *var-name;
  • Program :
#include <stdio.h>
#include <conio.h>
void main()
{
  int var = 5;
  clrscr();
  printf("\n----------------POINTERS----------------");
  printf("var: %d\n", var);
  printf("address of var: %p", &var);
  getch();
}

Union in C

  • Flowchart :






  • Syntax :

union [union tag] {
   member definition;
   member definition;
   ...
   member definition;
} [one or more union variables]; 

  • Program :

#include <stdio.h>
#include <conio.h>
#include <string.h>
union student
{
            char name[20];
            char subject[20];
            float percentage;
};

void main()
{
    union student record1;
    union student record2;
    clrscr();
       printf("\n----------------UNION----------------");
       strcpy(record1.name, "Raju");
       strcpy(record1.subject, "Maths");
       record1.percentage = 86.50;

       printf("Union record1 values example\n");
       printf(" Name       : %s \n", record1.name);
       printf(" Subject    : %s \n", record1.subject);
       printf(" Percentage : %f \n\n", record1.percentage);

       printf("Union record2 values example\n");
       strcpy(record2.name, "Mani");
       printf(" Name       : %s \n", record2.name);

       strcpy(record2.subject, "Physics");
       printf(" Subject    : %s \n", record2.subject);

       record2.percentage = 99.50;
       printf(" Percentage : %f \n", record2.percentage);
       getch();
}


Structure in C

  • Flowchart :


  • Syntax :

struct [structure tag] {

   member definition;
   member definition;
   ...
   member definition;
} [one or more structure variables]; 
  • Program :

#include <stdio.h>
#include <conio.h>
struct StudentData{
    char *stu_name;
    int stu_id;
    int stu_age;
};
void main()
{
   
     struct StudentData student;
     student.stu_name = "Steve";
     student.stu_id = 1234;
     student.stu_age = 30;
     clrscr();
     printf("\n----------------STRUCTURE----------------");
     printf("Student Name is: %s", student.stu_name);
     printf("\nStudent Id is: %d", student.stu_id);
     printf("\nStudent Age is: %d", student.stu_age);
     getch();
}


Recursion using factorial in C


  • Flowchart :






  • Syntax :

void recursion() {
   recursion(); /* function calls itself */
}

int main() {
   recursion();
}
  • Program :

#include <stdio.h>
#include <conio.h>
int fact (int);
void main()
{
    int n,f;
    clrscr();
    printf("\n----------------RECURSION----------------");
    printf("Enter the number :");
    scanf("%d",&n);
    f = fact(n);
    printf("factorial = %d",f);
}
int fact(int n)
{
    if (n==0)
    {
        return 0;
    }
    else if ( n == 1)
    {
        return 1;
    }
    else 
    {
        return n*fact(n-1);
    }
    getch();
}


Call by reference in C



  • Flowchart :


  • Program :

#include<stdio.h>
#include<conio.h>
void swapnum ( int *var1, int *var2 )
{
   int tempnum ;
   tempnum = *var1 ;
   *var1 = *var2 ;
   *var2 = tempnum ;
}
void main( )
{
   int num1 = 35, num2 = 45 ;
   clrscr();
   printf("\n----------------CALL BY REFERENCE----------------");
   printf("Before swapping:");
   printf("\nnum1 value is %d", num1);
   printf("\nnum2 value is %d", num2);

 
   swapnum( &num1, &num2 );

   printf("\nAfter swapping:");
   printf("\nnum1 value is %d", num1);
   printf("\nnum2 value is %d", num2);
   getch();
}


Call by value in C

  • Flowchart :


  • Program :

#include<stdio.h>
#include<conio.h>
int increment(int var)
{
    var = var+1;
    return var;
}

void main()
{
   int num1=20;
   int num2 = increment(num1);
   clrscr();
   printf("\n----------------CALL BY VALUE----------------");
   printf("num1 value is: %d", num1);
   printf("\nnum2 value is: %d", num2);
   getch();
}


String functions using switch in C


  • Flowchart :


  • Program :

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

int l, n;

char a[20], b[20], c[20];

clrscr();
printf("\n----------------STRING FUNCTIONS----------------");

printf("\n STRING OPERATIONS\t  \n1.String Concatenation\t  \n2.String Compare\t   \n3.String Copy\t  \n4.String Length\t  \n5.String Uppercase\t  \n6.String Lowercase\t  \n7.String Reverse\t  \n8.String Duplicate\t");

printf("\n Enter your choice:");

scanf("%d", &n);

switch(n)

{

case 1:

printf("\n Enter A :");

scanf("%s",&a);

printf("\n Enter B :");

scanf("%s",&b);

strcat(a, b);

printf("\n String concatenation :%s\t", a);

break;

case 2:

printf("\n Enter A :");

scanf("%s",&a);

printf("\n Enter B :");

scanf("%s",&b);

if(strcmp(a, b)==0)

printf("\n Strings are equal");

else

printf("\n Strings are not equal");

break;

case 3:

printf("\n Enter B :");

scanf("%s",&b);

strcpy(c, b);

printf("\n String copy :%s\t", c);

break;

case 4:

printf("\n Enter A :");

scanf("%s",&a);
l=strlen(a);

printf("\n length of string :%d\t", l);

break;

case 5:

printf("\n Enter A :");

scanf("%s",&a);

printf("\n String uppercase:%s\n",strupr(a));

break;

case 6:

printf("\n Enter A :");
scanf("%s",&a);

printf("\n String lowercase :%s\n",strlwr(a));

break;

case 7:

printf("\n Enter A :");
scanf("%s",&a);

printf("\n String reverse :%s\n",strrev(a));

break;

case 8:

printf("\n Enter A :");
scanf("%s",&a);

printf("\n String duplicate :%s\n",strdup(a));

break;

default:

printf("\n wrong entry");

}

getch();

}


Merge of array in C

  • Flowchat :

  • Program :

#include<stdio.h>
#include<coio.h>
void main()
{
  int aSize, bSize, mSize, i, j;
int a[10], b[10], Merged[20];
        clrscr();
        printf("\n----------------MERGE OF ARRAY----------------");
  printf("\n Please Enter the First Array Size  :  ");
  scanf("%d", &aSize);

  printf("\nPlease Enter the First Array Elements :  ");
  for(i = 0; i < aSize; i++)
  {
      scanf("%d", &a[i]);
  }
  printf("\n Please Enter the Second Array Size  :  ");
  scanf("%d", &bSize);
 
  printf("\nPlease Enter the Second Array Elements  :  ");
  for(i = 0; i < bSize; i++)
  {
      scanf("%d", &b[i]);
  }
 
  for(i = 0; i < aSize; i++)
  {
      Merged[i] = a[i];
  }
 
mSize = aSize + bSize;

  for(i = 0, j = aSize; j < mSize && i < bSize; i++, j++)
  {
  Merged[j] = b[i];
  }

  printf("\n a[%d] Array Elements After Merging \n", mSize);
  for(i = 0; i < mSize; i++)
  {
    printf(" %d \t ",Merged[i]);
  }

  getch();
}


Sort of array in C

  • Flowchart :










  • Program :

 #include <stdio.h>
 #include <conio.h>
 void main()
    {

        int i, j, a, n, number[30];
        clrscr();
        printf("\n----------------SORT OF ARRAY----------------");
        printf("Enter the value of N \n");
        scanf("%d", &n);

        printf("Enter the numbers \n");
        for (i = 0; i < n; ++i)
            scanf("%d", &number[i]);

        for (i = 0; i < n; ++i)
        {

            for (j = i + 1; j < n; ++j)
            {

                if (number[i] > number[j])
                {

                    a =  number[i];
                    number[i] = number[j];
                    number[j] = a;

                }

            }

        }

        printf("The numbers arranged in ascending order are given below \n");
        for (i = 0; i < n; ++i)
            printf("%d\n", number[i]);
        getch();
    }


Search of array in C




  • Flowchart :

  • Program :

#include <stdio.h>
#include <conio.h>
void main()
{
  int array[100], search, c, n;
  clrscr();
  printf("\n----------------SEARCH OF ARRAY----------------");
  printf("Enter number of elements in array\n");
  scanf("%d", &n);

  printf("Enter %d integer(s)\n", n);

  for (c = 0; c < n; c++)
    scanf("%d", &array[c]);

  printf("Enter a number to search\n");
  scanf("%d", &search);

  for (c = 0; c < n; c++)
  {
    if (array[c] == search)    /* If required element is found */
    {
      printf("%d is present at location %d.\n", search, c+1);
      break;
    }
  }
  if (c == n)
    printf("%d isn't present in the array.\n", search);

  getch();
}


Deletion of array in C

  • Flowchart :

  • Program :
#include <stdio.h>
#include <conio.h>
void main()
{
   int array[100], position, c, n;
   clrscr();
   printf("\n----------------DELETION OF ARRAY----------------");
   printf("Enter number of elements in array\n");
   scanf("%d", &n);

   printf("Enter %d elements\n", n);

   for (c = 0; c < n; c++)
      scanf("%d", &array[c]);

   printf("Enter the location where you wish to delete element\n");
   scanf("%d", &position);

   if (position >= n+1)
      printf("Deletion not possible.\n");
   else
   {
      for (c = position - 1; c < n - 1; c++)
         array[c] = array[c+1];

      printf("Resultant array:\n");

      for (c = 0; c < n - 1; c++)
         printf("%d\n", array[c]);
   }

   getch();
}

Insertion of array in C

  • Flowchart :
  • Program :


#include <stdio.h>
#include<conio.h> 
void main()
{
   int array[100], position, c, n, value;
   clrscr();
   printf("\n----------------INSERTION OF ARRAY----------------");
   printf("Enter number of elements in array\n");
   scanf("%d", &n);
   printf("Enter %d elements\n", n);
   for (c = 0; c < n; c++)
      scanf("%d", &array[c]);
   printf("Enter the location where you wish to insert an element\n");
   scanf("%d", &position);
   printf("Enter the value to insert\n");
   scanf("%d", &value);
   for (c = n - 1; c >= position - 1; c--)
      array[c+1] = array[c];
   array[position-1] = value;
   printf("Resultant array is\n");
   for (c = 0; c <= n; c++)
      printf("%d\n", array[c]);
   getch();
}

Three or multi dimensional array in C

  • Flowchart :
  • Syntax :
type name[size1][size2]...[sizeN];
  • Program :
#include<stdio.h>
#include<conio.h>

void main()
{
int i, j, k, x=1;
int arr[3][3][3];
clrscr();
printf("\n----------------3D ARRAY----------------");
printf(":::3D Array Elements:::\n\n");

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
{
arr[i][j][k] = x;
printf("%d\t",arr[i][j][k]);
x++;
}
printf("\n");
}
printf("\n");
}
getch();
}

Two dimensional array in C

  • Flowchart :
  • Syntax :
data_type array_name[rows][columns];  
  • Program :
#include<stdio.h> 
#include<conio.h>   
void main ()    
{    
    int arr[3][3],i,j;
    clrscr();
    printf("\n----------------2D ARRAY----------------");     
    for (i=0;i<3;i++)    
    {    
        for (j=0;j<3;j++)    
        {    
            printf("Enter a[%d][%d]: ",i,j);                
            scanf("%d",&arr[i][j]);    
        }    
    }    
    printf("\n printing the elements ....\n");     
    for(i=0;i<3;i++)    
    {    
        printf("\n");    
        for (j=0;j<3;j++)    
        {    
            printf("%d\t",arr[i][j]);    
        }    
    } 
    getch();   

One dimensional array in C




  • Flowchart :


  • Syntax :

 datatype array_name[size];
  • Program :

#include<stdio.h>
#include<conio.h>
void main()
{
    int arr[5], i;
    clrscr();
    printf("\n----------------1D ARRAY----------------");
    for(i = 0; i < 5; i++)
    {
        printf("Enter a[%d]: ", i);
        scanf("%d", &arr[i]);
    }

    printf("\nPrinting elements of the array: \n\n");

    for(i = 0; i < 5; i++)
    {
        printf("%d ", arr[i]);
    }

 
    getch();
}


Tuesday, April 14, 2020

For loop in C

  • Flowchart :



  • Syntax :
for (initialization; condition; increment ) 
{   
//statement block;
}
  • Program :
#include<stdio.h> 
#include<conio.h> 
int main ()
{
  int n,time,i;
  clrscr(); 
  printf("\n----------------FOR LOOP----------------");
  printf("\nEnter n and time value :");
  scanf("%d%d",&n,&time);
   for(i=n;i<=time;i=i+1)
   {
      printf("\n n : %d",i);
   }
   getch();
}

Do while loop in C

do
{
    Statement; 

}while(condition test);
  • Program :
#include<stdio.h>
#include<conio.h>
void main ()
{
   int n,time;
   clrscr();
   printf("\n----------------DO WHILE LOOP----------------");
   printf("\nEnter n and time value :");
   scanf("%d%d",&n,&time);
   do
   {
       printf("\n n = %d",n);
       n = n + 1;
   }while(n<=time);
   getch();
}

While loop in C

  • Flowchart :
  • Syntax :
while (condition test)
{
      //Statements to be executed repeatedly 
      // Increment (++) or Decrement (--) Operation
}
  • Program :
#include<stdio.h>
#include<conio.h>
void main ()
{
   int n,time;
   clrscr();
   printf("\n----------------WHILE LOOP----------------");
   printf("\nEnter n and time value :");
   scanf("%d%d",&n,&time);
   while(n<=time)
   {
      printf("\n n = %d",n);
      n++;
   }
  getch();
}

Switch statement in C

  • Flowchart :

  • Syntax :
switch( expression )
{
 case value-1:
   Block-1;
   Break;
 case value-2:
   Block-2;
   Break;
 case value-n:
   Block-n;
   Break;
 default:
   Block-1;
   Break;
}
Statement-x;
  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f,g,operator;
clrscr();
printf("\n----------------SWITCH STATEMENT----------------");
printf("\n The operators are  \n1.Add  \n2.Subtract  \n3.multiply  \n4.divide  \n5.modulo");
printf("\n Enter the operator:");
scanf("%d",&operator);
printf("\n Enter the Two numbers:");
scanf("%d%d",&a,&b);
switch(operator)
{
case 1:
c=a+b;
printf("\nsum is : %d",c);
break;
case 2:
d=a-b;
printf("\ndifference is : %d",d);
break;
case 3:
e=a*b;
printf("\nmultiply is : %d",e);
break;
case 4:
f=a/b;
printf("\ndivide is : %d",f);
break;
case 5:
g=a%b;
printf("\nmodulo is : %d",g);
break;
default:
printf("\n Error");
break;
}
getch();
}

Goto statement in C


  • Flowchart :
  • Syntax :
goto label;
... .. ...
... .. ...
label: 
statement;
  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
   int sum,i;
   clrscr();
   printf("\n----------------GOTO STATEMENT----------------");
   printf("\nEnter the sum value :");
   scanf("%d",&sum);
   for(i=0;i<=10;i++)
  {
sum=sum+i;
if(i==5)
        {
   goto addition;
}
   }

   addition:
   printf("\nThe sum is : %d",sum);
   getch();
}

Nested else-if statement in C

  • Flowchart :
  • Syntax :
if (condition)
    statement;
else if (condition)
    statement;
.
.
else
    statement;
  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
int s1,s2,s3,s4,s5,sum;
        float total;
        clrscr();
        printf("\n----------------NESTED ELSE-IF STATEMENT----------------");
        Printf("\nEnter Tamil mark :");
        scanf("%d",&s1);
        Printf("\nEnter English mark :");
        scanf("%d",&s2); 
        Printf("\nEnter Maths mark :");
        scanf("%d",&s3);
        Printf("\nEnter Science mark :");
        scanf("%d",&s4);
        Printf("\nEnter Social mark :");
        scanf("%d",&s5);
        sum=s1+s2+s3+s4+s5;
        Printf("\nOver all marks is :%d",sum);
        total=sum/5;
        Printf("\nOver all percentage is :%d",sum);
if(total>75){
printf("First class");
}
else if(total>65){
printf("Second class");
}
else if(total>55){
printf("Third class");
}
else{
printf("Fourth class");
}
getch();
}

Nested if statement in C

  • Flowchart :
  • Syntax :
if (condition1) 
{
   // Executes when condition1 is true
   if (condition2) 
   {
      // Executes when condition2 is true
   }
}
  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
 int a;
 clrscr();
 printf("\n----------------NESTED IF STATEMENT----------------");
 printf("\nEnter Your Age :");
 scanf("%d",&a);
 if(a<18)
{
  printf("\nYou are Minor");
  printf("\nNot Eligible to Work");
 }
 else
 {

  if(a>=18 && a<=60) 
   { 
    printf("\nYou are Eligible to Work"); 
    printf("\nPlease fill in your details and apply"); 
   } 
  else 
   { 
    printf("\nYou are too old to work as per the Government rules");
    printf("\nPlease Collect your pension!");
   }
 }
getch();
}

If-else statement in C

  • Flowchart :
  • Syntax :
if (condition)
{
    // Executes this block if
    // condition is true
}
else
{
    // Executes this block if
    // condition is false
}
  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
  int a;
  clrscr();
  printf("\n----------------IF-ELSE STATEMENT----------------");
  printf("\nEnter your age :");
  scanf("%d",&a);
  if(a>=18)
  printf("\nYou are a major");
  else
  printf("\nYou are not a major"); 
  getch();
}

If statement in C

  • Flowchart :
  • Syntax :
if(condition) 
{
   // Statements to execute if
   // condition is true
}
  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
  int a;
  clrscr();
  printf("\n----------------IF STATEMENT----------------");
  printf("\nEnter your age :");
  scanf("%d",&a);
  if(a>=18)
  printf("\nYou are major.");
  getch();
}

Monday, April 13, 2020

Special operators in C

  • Program :
#include<stdio.h>
#include<conio.h>
#include<limits.h>
void main()
{
int *a,b,c;
char d;
float e;
double f;
clrscr();
printf("\n----------------SPECIAL OPERATORS----------------");
printf("\nEnter B value:");
scanf("%d",&b);
printf("\n----------------SPECIAL OPERATOR(&)----------------");
a=&b;
printf("\nThe address of a memory location is : %d",a);
printf("\n----------------SPECIAL OPERATOR(*)----------------");
printf("\nPointer to a variable is : %d",*a);
printf("\n----------------SPECIAL OPERATOR(sizeof())----------------");
printf(" \nSize for int is : %d",sizeof(c));
printf(" \nSize for char is : %d",sizeof(d));
printf(" \nSize for float is : %d",sizeof(e));
printf("\nSize for double is : %d",sizeof(f));
getch();
}

Conditional operator in C

  • Program :
#include <stdio.h>
#include<conio.h> 
void main()
{
   int m,n;
   clrscr();
   printf("\n----------------CONDITIONAL OPERATOR(?:)----------------");
   printf("\nEnter M and N values:");
   scanf("%d%d",&m,&n);
   n=(m==1?2:0) ;
   printf("\nm value is : %d",m);
   printf("\nn value is : %d",n);
   getch();
}

Assignment operators in C

  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
 int a,b;
 clrscr();
 printf("\n----------------ASSIGNMENT OPERATORS----------------");
 printf("\nEnter A and B values:");
 scanf("%d%d",&a,&b);
 printf("\n----------------ASSIGNMENT OPERATOR(=)----------------");
 printf("\nAssign operator is : A= %d, B=%d",a,b);
 printf("\n----------------ASSIGNMENT OPERATOR(+=)----------------");
 printf("\nIncrements then assign is : %d",a+=b);
 printf("\n----------------ASSIGNMENT OPERATOR(-=)----------------");
 printf("\nDecrements then assign is : %d",a-=b);
 printf("\n----------------ASSIGNMENT OPERATOR(*=)----------------");
 printf("\nMultiplies then assign is : %d",a*=b);
 printf("\n----------------ASSIGNMENT OPERATOR(/=)----------------");
 printf("\nDivides then assign is : %d",a/=b);
 printf("\n----------------ASSIGNMENT OPERATOR(%=)----------------");
 printf("\nModulus then assign is : %d",a%=b);
 getch();
}

Bitwise operators in C

  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b,num=252,i;
    clrscr();
    printf("\n----------------BITWISE OPERATORS----------------");
    printf("\nEnter any two values:");
    scanf("%d%d",&a,&b);
    printf("\n----------------BITWISE OPERATOR(&)----------------");
    printf("\nBitwise AND is : %d",a&b);
    printf("\n----------------BITWISE OPERATOR(|)----------------");
    printf("\nBitwise OR is : %d",a|b);
    printf("\n----------------BITWISE OPERATOR(^)----------------");
    printf("\nBitwise XOR is : %d", a^b);
    printf("\n----------------BITWISE OPERATOR(~)----------------");
    printf("\nBitwise complement operator is : %d",~a);
    printf("\nBitwise complement operator is : %d",~-b);
    printf("\n----------------BITWISE OPERATOR(>>)----------------");
     for (i=0; i<=2; ++i)
        printf("\nRight shift  %d is : %d",i,m>>i);
    printf("\n----------------BITWISE OPERATOR(>>)----------------");
     for (i=0; i<=2; ++i) 
        printf("\nLeft shift %d is : %d",i,m<<i);
    getch();
}

Logical operators in C




  • Program :

#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,d,e,f;
    clrscr();
    printf("\n----------------LOGICAL OPERATORS----------------");
    printf("\nEnter any three values:");
    scanf("%d%d%d",&a,&b,&c);
    printf("\n----------------LOGICAL OPERATOR(&&)----------------");
    d=(a==b)&&(c>b);
    printf("\nLogical AND is : %d",d);
    printf("\n----------------LOGICAL OPERATOR(||)----------------");
    e=(a==b)||(c<b);
    printf("\nLogical OR is : %d",e);
    printf("\n----------------LOGICAL OPERATOR(!=)----------------");
    f=!(a==b);
    printf("\nLogical NOT is : %d",f);
    getch();
}


Relational operators in C


  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b;
    clrscr();
    printf("\n----------------RELATIONAL OPERATORS----------------");
    printf("\nEnter two values:");
    scanf("%d%d",&a,&b);
    printf("\n----------------RELATIONAL OPERATOR(==)----------------");
    printf("\n%d == %d is %d", a,b,a==b);
    printf("\n----------------RELATIONAL OPERATOR(>)----------------");
    printf("\n%d > %d is %d", a,b,a>b);
    printf("\n----------------RELATIONAL OPERATOR(<)----------------");
    printf("\n%d < %d is %d", a,b,a<b);
    printf("\n----------------RELATIONAL OPERATOR(!=)----------------");
    printf("\n%d != %d is %d", a,b,a!=b);
    printf("\n----------------RELATIONAL OPERATOR(>=)----------------");
    printf("\n%d >= %d is %d", a,b,a>=b);
    printf("\n----------------RELATIONAL OPERATOR(<=)----------------");
    printf("\n%d <= %d is %d", a,b,a<=b);
    getch();
}

Increment and decrement operators in C


  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b;
    clrscr();
    printf("\n----------------INCREMENT AND DECREMENT OPERATORS----------------");
    printf("\nEnter any two values:");
    scanf("%d%d",&a,&b);
    printf("\n----------------INCREMENT OPERATOR(++)----------------");
    printf("\n Increment is : %d",++a);
    printf("\n----------------DECREMENT OPERATOR(--)----------------");
    printf("\n Decrement is : %d",--b);
    getch();
}

Arithmetic operators in C


  • Program :
#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,d,e,f,g;
    clrscr();
    printf("\n----------------ARITHMETIC OPERATORS----------------");
    printf("\nEnter A and B values:");
    scanf("%d%d",&a,&b);
    printf("\n----------------ARITHMETIC OPERATOR(+)----------------");
    c=a+b;
    printf("\nSum is : %d",c);
    printf("\n----------------ARITHMETIC OPERATOR(-)----------------");
    d=a-b;
    printf("\nDifference is : %d",d);
    printf("\n----------------ARITHMETIC OPERATOR(*)----------------");
    e=a*b;
    printf("\nMultiply is : %d",e);
    printf("\n----------------ARITHMETIC OPERATOR(/)----------------");
    f=a/b;
    printf("\nDivision is : %d",f);
    printf("\n----------------ARITHMETIC OPERATORS(%)----------------");
    g=a%b;
    printf("\nModulo is : %d",g);
    getch();
}

Print sum of numbers using C


  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\n----------------PRINT SUM OF NUMBERS----------------");
printf("\nEnter any two numbers:");
scanf("%d %d", &a, &b);
c =  a + b;
printf("\nThe addition of two number is: %d", c);
getch();
}

Print user defined values using C

  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\n----------------PRINT USER DEFINED VALUES----------------");
printf("\nPlease enter any two numbers:");
scanf("%d%d",&a,&b);
printf("\nThe two numbers are: %d %d",a,b);
getch();
}

Print default values using C

  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
int a= 100;
int b= 20;
clrscr();
scanf("%d%d",&a, &b);
printf("\n----------------PRINT DEFAULT VALUES----------------");
printf("\nThe value of A nd B is:%d %d",a,b);
getch();

}

Print statement using C


  • Program :
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\n----------------PRINT STATEMENT----------------");
printf("\nMonitech");
getch();
}

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...