0% found this document useful (0 votes)
32 views8 pages

PF Project

The document contains the code for a C program that allows a user to select different math operations and calculations to perform. It includes options for basic arithmetic, trigonometric functions, geometric areas, tables, factorials and conversions.

Uploaded by

rohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views8 pages

PF Project

The document contains the code for a C program that allows a user to select different math operations and calculations to perform. It includes options for basic arithmetic, trigonometric functions, geometric areas, tables, factorials and conversions.

Uploaded by

rohan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

#include<stdio.

h>

#include<math.h>

int main()

{ int choice,choice1,choice2,choice3,choice4,choice5,choice6,choice7;

float x,y,result;

do{

printf("Select Any operations:\nZero(0) to exit:\n");

printf("1_Enter 1 for Solving Basic Arithmatic:\n");

printf("2_Enter 2 for Trignometric funtions and their Values:\n");

printf("3_Geometric Areas:\n");

printf("4_Exponential problems:\n");

printf("5_Tables:\n");

printf("6_Unknown:\n");

printf("7_Factorial:\n");

printf("8_Some Conversions:\n");

scanf("%d",&choice);

if(choice==1)

printf("1. Addition\n2. Subtraction\n3. Multiplication\n4. Division\n");

scanf("%d",&choice1);

switch(choice1){

case 1:

printf("Enter X: ");

scanf("%f", &x);

printf("\nEnter Y: ");

scanf("%f", &y);

result = x + y;

printf("\nResult: %f", result);


break;

case 2:

printf("Enter X: ");

scanf("%f", &x);

printf("\nEnter Y: ");

scanf("%f", &y);

result=x-y;

printf("\nResult: %f", result);

break;

case 3:

printf("Enter X: ");

scanf("%f", &x);

printf("\nEnter Y: ");

scanf("%f", &y);

result = x * y;

printf("\nResult: %f", result);

break;

case 4:

printf("Enter X: ");

scanf("%f", &x);

printf("\nEnter Y: ");

scanf("%f", &y);

result = x / y;

printf("\nResult: %f", result);

break;

printf("\n\n");

if(choice==2)
{

printf("1_Value of Sin\n");

printf("2_Value of cos\n");

printf("3_Value of tan\n");

scanf("%d",&choice2);

switch(choice2){

case 1:{

float value,i;

printf("enter value");

scanf("%f",&value);

i=(value*3.1415)/180;

float sin_value = sin(i);

printf("The value of sin(%f) : %f \n", i, sin_value);

break;

case 2:{

float value,i;

printf("enter value");

scanf("%f",&value);

i=(value*3.1415)/180;

float cos_value = cos(i);

printf("The value of cos(%f) : %f \n", i, cos_value);

break;

} case 3:{

float value,i;

printf("enter value");

scanf("%f",&value);

i=(value*3.1415)/180;

float tan_value = tan(i);


printf("The value of tan(%f) : %f \n", i, tan_value);

break;

} }

if(choice==3)

printf("Enter\n1 for Triangle\n2 for Square\n3 for Circle\n4 for Rectangle\n5 for
Parallelogram\n");

scanf("%d",&choice3);

switch(choice3)

case 1:

int a,b,c;

float s,area;

printf("Enter sides of triangle\n");

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

s=(float)(a+b+c)/2;

area=(float)(sqrt(s*(s-a)*(s-b)*(s-c)));

printf("Area of Triangle with sides %d,%d,%d is %f\n",a,b,c,area);

break;

case 2:

float side,area;

printf("Enter Sides of Square\n");

scanf("%f",&side);

area=(float)side*side;

printf("Area of Square is %f\n",area);


break;

case 3:

float radius,area;

printf("Enter Radius of Circle\n");

scanf("%f",&radius);

area=(float)3.14159*radius*radius;

printf("Area of Circle with radius %f is %f\n",radius,area);

break;

case 4:

float len,breadth,area;

printf("Enter Length and Breadth of Rectangle\n");

scanf("%f %f",&len,&breadth);

area=(float)len*breadth;

printf("Area of Rectangle is %f\n",area);

break;

case 5:

float base,height,area;

printf("Enter base and height of Parallelogram\n");

scanf("%f %f",&base,&height);

area=(float)base*height;

printf("Enter area of Parallelogram is %f\n",area);

break;

}
printf("\n\n");

if(choice==4){

if(choice==5)

{int i=1,j=0,x,n;

printf("Enter No. Which Table You Want To Find\n");

scanf("%d",&x);

printf("Enter Limit 0f Table\nFor example\t10\t15\t20....");

scanf("%d",&n);

while(i<=n)

{j+=x;

printf("%d\n",j);

i++;

}while(i<=10);

if(choice==6)

}
if(choice==7)

int i,factorial=1,x;

printf("Enter Number Wich Factorial You Want To Find");

scanf("%d",&x);

for(i=1;i<=x;i++)

{factorial=factorial*i;

printf("%d\n\n",factorial);

if(choice==8)

{ int km,m,cm,mm;

float feet,inch;

printf("enter distance in KM");

scanf("%d",&km);

m = km*1000;

feet= km*3280.84;

inch=km*39370.1;

cm=km*100000;

mm=cm*10;

printf("distance in meters is%d\n",m);

printf("distance in feets is 2%f\n",feet);

printf("distance in inches is 2%f\n",inch);

printf("distance in centimers is%d\n",cm);

printf("distance in milimeters is%d\n",mm);

}while(choice!=0);

return 0;
}

You might also like