You are on page 1of 3

/*BITWISE OPERATORS*/

/*WRITTEN BY A.DEVIPRIYA */
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,e,f,g,i,j;
printf( \n enter the values of a,b,c,d: );
scanf( %f%f%f%f ,&a,&b,&c,&d);
e=(a<=b)&&(c<=d);
f=(a<=b)||(c<=d);
g=(a<=b)^(c<=d);
i=3<<1;
j=3>>1;
printf( \n the left shift value is :%d ,i);
printf( \n the right shift value is :%d ,j);
printf( \n the value of and :%d ,e);
printf( \n the value of or :%d ,f);
printf( \n the value of ex-or :%d ,g);
getch();
}

-------------------
/* FORMATTED I/O STATEMENT */
/*WRITTEN BY A.DEVIPRIYA */
#include<stdio.h>
#include<conio.h>
main()
{
int i,j;
long ix;
short s;
unsigned u;
float x;
double dx;
char c;
printf("\n enter the values:");
printf( \n i,j=int,x=float,dx=double );
scanf("%4d%4d%8f%15lf\n",&i,&j,&x,&dx);
printf( \n i=%d\tj=%d\tx=%f\tdx=%lf\t ,i,j,x,dx);
printf("enter the values:");
printf( \n i=int,ix=long,j-int,x=float,u=unsigned );
scanf("%5d%12d%5d%10f%u",&i,&ix,&j,&x,&u);
printf( \n i=%d\tix=%d\tj=%d\tx=%f\tu=%u\t ,i,ix,j,x,u);
printf("\n enter the values:");
printf( \n i=int,u=unsigned,c=char );
scanf("%6d%6u%6c",&i,&u,&c);
printf( \n i=%d\tu=%d\tc=%c\t ,i,u,c);
getch();
}

--------
/* UNFORMATTED I/O STATEMENT */
/*WRITTEN BY A.DEVIPRIYA */
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char letter[20];
clrscr();
printf( \n enter the string : ) ;
gets(letter);
printf( \n the entered string is : );
puts(letter);
getch();
}

----
/* UNFORMATTED I/O */
/*WRITTEN BY A.DEVIPRIYA */
#include<stdio.h>
#include<conio.h>
main()
{
char ch;
printf( \n enter any character: ) ;
ch=getchar();
printf( \n the equivalent upper case character is );
putchar(toupper(ch));
getch();
}

---
/* FORMATTED I/O */
/*WRITTEN BY A.DEVIPRIYA */
#include<stdio.h>
#include<conio.h>
main()
{
int i=1234,j=5678,k=7889;
float x=1234.56,y=5656.89,z=45.789;
clrscr();
printf( \n illustration of formatted io: );
printf( i=%3d j=%3d k=%3d ,i,j,k);
printf( \n here i,j,k, are integers );
printf( i+j=%5d i-k=%5d ,i+j,i-k);
printf( \n here x,y,z are floating point value );
printf( x+y=%4f x-z=%5d ,x+y,x-z);
getch();
}

You might also like