elbawonknu
Elite
libre lait hahaha hirap pala ng C di gaya ng mga ordinary computer langauge kailangan accurate ang i store mo na mga data type hehhe
need kasi maintindihan ang C lalo kung plano mag malware developer ehh kasi halos need to para makipag communicate ca hardware at need ma understand how Computer working di gaya ng ibang Computer Language hehhe
C:
#include <stdio.h>
#include <math.h>
int main(){
int chossen = 0;
float pi = 3.141593;
while (chossen != 6){
printf("==== ADVANCE CALCULATOR ====\n");
printf("1. Circle(area and circumference).\n");
printf("2: Triangle (area using Heron's formula).\n");
printf("3: Rectangle (area and perimeter).\n");
printf("4: Sphere (volume and surface area).\n");
printf("5: Pythagorean theorem (find hypotenuse).\n");
printf("6: Exit.\n");
while(chossen < 1 || chossen > 6){
printf("Please Choose to the menu:");
scanf("%d",&chossen);
if(chossen < 1 || chossen > 6 ){
printf("Negative Value or Zero or more than the Me nenu is not Valid.\n");
}
}
if(chossen == 1 ){
float radius= 0.0f;
///while loop para ma check kung negative ito or positive///
while(radius < 1){
printf("please enter radius:");
scanf("%f", &radius);
if(radius <= 0){
printf("Radius cannot be in negative or Zero.\n");
}
}
printf("Circle with radius %.2f:\n",radius);
printf("Area: %.2f square units.\n",pi * pow(radius,2) );
printf("Circumference: %.2f units.\n", 2 * pi * radius);
return 0;
}
if(chossen == 2){
float a = 0.0f;
while (a < 1){
printf("Please input variable a in (a + b + c):");
scanf("%f",&a);
if(a <= 0){
printf("Variable A cannot be negative or Zero\n");
}
}
float b = 0.0f;
while (b < 1){
printf("Please input variable b in (a + b + c):");
scanf("%f",&b);
if(b <= 0){
printf("Variable B cannot be negative or Zero\n");
}
}
float c = 0.0f;
while (c < 1){
printf("Please input variable c in (a + b + c):");
scanf("%f",&c);
if(c <= 0){
printf("Variable C cannot be negative or Zero\n");
}
}
float semiperimeter = (a + b + c)/2;
printf("The semiperimeter is %.2f meters\n", semiperimeter);
double Area;
float multiplyall;
multiplyall = semiperimeter * (semiperimeter - a) * (semiperimeter - b) * (semiperimeter - c);
Area = sqrt(multiplyall);
printf("The Area is %.11lf meterssquared\n", Area);
return 0;
}
if(chossen == 3){
float length = 0.0f;
float width = 0.0f;
while (length < 1){
printf("Please input value for length:");
scanf("%f",&length);
if(length <= 0){
printf("Variable length cannot be negative or Zero\n");
}
}
while (width < 1){
printf("Please input value for width:");
scanf("%f",&width);
if(width <= 0){
printf("Variable width cannot be negative or Zero\n");
}
}
printf("Area is: %.2f\n",length * width);
printf("Perimeter is: %.2f\n",2 * (length + width));
return 0;
}
if(chossen == 4){
float radius = 0.0f;
float volume = 0.0f;
float surfacearea = 0.0f;
while(radius < 1){
printf("Please Input Radius:");
scanf("%f", &radius);
if(radius <= 0){
printf("Variable Radius cannot be negative or Zero\n");
}
}
volume = 4.00/3.00 * (pi * pow(radius,3));
surfacearea = 4 * (pi * pow(radius,2));
printf("Volume is %.2f\n",volume);
printf("Surface Area is %.5f\n",surfacearea);
return 0;
}
if(chossen == 5){
float a = 0.0f;
float b = 0.0f;
while(a < 1){
printf("Please input For variable A:");
scanf("%f", &a);
if(a <= 0 ){
printf("Variable A cannot be Negative Value or Zero\n");
}
}
while(b < 1){
printf("Please input For variable B:");
scanf("%f", &b);
if(b <= 0 ){
printf("Variable A cannot be Negative Value or Zero\n");
}
}
float findsqrt = pow(a,2) + pow(b,2);
printf("Hypotenuse is %f", sqrt(findsqrt));
return 0;
}
} //end ito ng while loop///
}
need kasi maintindihan ang C lalo kung plano mag malware developer ehh kasi halos need to para makipag communicate ca hardware at need ma understand how Computer working di gaya ng ibang Computer Language hehhe