Ex No: Date: 2.1.expression Evaluation
Ex No: Date: 2.1.expression Evaluation
Ex No: Date: 2.1.expression Evaluation
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,y;
clrscr();
printf("Enter the value of a,b and c\n");
scanf("%d%d%d" ,&a,&b,&c);
y=a+b/c-a%c+2*a;
printf("the result of the expression is %d\n\n\n",y);
a=10;
printf("The value of a is %d\n",a);
printf("The value of preincrement operator is %d\n",++a);
printf("The value of a is %d\n",a);
printf("The value of postincrement operator is %d\n",a++);
printf("The value of a is %d\n",a);
printf("The value of predecrement operator is %d\n",--a);
printf("The value of a is %d\n",a);
printf("The value of postdecrement operator is %d\n",a--);
printf("The value of a is %d\n",a);
getch();
}
EX NO:
DATE: 2.1.EXPRESSION EVALUATION
OUTPUT:
The value of a is 10
The value of preincrement operator is 11
The value of a is 11
The value of postincrement operator is 11
The value of a is 12
The value of predecrement operator is 11
The value of a is 11
The value of postdecrement operator is 11
The value of a is 10
EX NO:
DATE: 2.2.CONVERSION BETWEEN CELSIUS TO FAHRENHEIT
#include<stdio.h>
#include<conio.h>
void main()
{
float c,f;
clrscr();
printf("Enter the Degree Celsius Value\n");
scanf("%f",&c);
f=(1.8*c)+32;
printf("the Farenheit Value for %.2f celsius is %.2f \n",c,f);
OUTPUT:
#include<stdio.h>
#include<conio.h>
#include<math.h>
#define pi 3.14
void main()
{
float AC,s,AT,t,r,a,b,c,f;
clrscr();
//Area of a circle
printf("Area of the Circle\n");
printf("Enter the radius of the circle\nr=");
scanf("%f",&r);
AC=pi*r*r;
printf("The Area of the circle is %f\n",AC);
//Area of a triangle
printf("Area of the Triangle\n");
printf("Enter the a,b,c values\n");
scanf("\n%f\n%f\n%f",&a,&b,&c);
printf("The value of s=");
s=(a+b+c)/2;
printf("%f",s);
t=s*(s-a)*(s-b)*(s-c);
AT=sqrt(t);
printf("\nThe area of the triangle is %f",AT);
getch();
}
OUTPUT:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,p;
float n,sn,r,d;
clrscr();
//power of a number
printf("\nEnter the base and power value\n");
scanf("%d%d",&a,&b);
p=pow(a,b);
printf("The power is %d \n",p);
//Trignometric Functions
printf("\nEnter the Radians value\n");
scanf("%f",&r);
d=(180/3.14)*r;
printf("The degree value is %f\n",d);
printf("\nThe cosine value is %f\n",cos(d));
printf("The sine value is %f\n",sin(d));
printf("The tan value is %f\n",tan(d));
getch();
}
EX NO:
DATE: 2.3.MATHEMATIC FUNCTIONS
OUTPUT: