a. Write a simple program that prints the results of all the operators available in C (including pre/ post increment, bitwise and/or/not, etc.). Read required operand values from standard input. 

Code:

#include<stdio.h>

void main( )

{

int a, b;

printf("Enter the values of a and b : "); 

scanf("%d%d",&a,&b); 

printf("\nThe arithmetic operators result is: %d %d %d %d", a+b,a-b,a*b,a/b); 

printf("\nThe relational operators result is : %d %d %d %d", a>b,a<b,a>=b,a<=b); 

printf("\nThe logical operators result is : %d %d %d", a&&b,a||b,!(a==b)); 

printf("\nThe increment operator result is : %d %d %d %d",a++,++a,b++,++b); 

printf("\nThe decrement operator result is : %d %d %d %d",a--,--a,b--,--b); 

printf("\nThe bitwise AND operator result is : %d",a&b); 

printf("\nThe bitwise OR operator result is : %d",a|b); 

printf("\nThe bitwise NOT operator result is : %d",a^b); 

Output:


b. Write a simple program that converts one given data type to another using auto conversion and casting. Take the values form standard input. 

Code:

#include<stdio.h> 
//#include<conio.h> //supports with windows or some compilers only
void main()
{
float sum,count;
int mean;
//clrscr(); //supports with windows or some compilers only
printf("enter the value of sum and count : "); 
scanf("%f%f",&sum,&count); mean=sum/count;
printf(" the value of mean is : %d\n", mean); 

Output: