LAB 1 Generic 1 (Circumference and area of a circle calculation program)
void setup(){
float Diameter = 8.0;float circum;float area;
circum = 2*PI*(Diameter/2);
area = PI*(pow((Diameter/2),2));
println("***Circumference and area of a circle calculation program***");
println("Diameter = "+Diameter+" m");
println("Circumference = "+circum+" m");
println("Area = "+area+" m^2");
}
LAB 1 Generic 2 (BMI calculator)
void setup(){
float Weight = 65.0;float Height = 167 ;float BMI;
BMI = Weight/(pow(Height/100,2));
println("***BMI calculator***");
println("Weight = "+Weight+" Kg");
println("Height = "+Height+" cm");
println("BMI = "+BMI);
}
LAB 1 Generic 3 (Sphere's volume calculator)
void setup(){
float radius = 3.0;float volume;
volume = (PI*4/3)*(pow(radius,3));
println("***Sphere's volume calculator***");
println("Radius = "+radius+" m");
println("Volume = "+volume+" m^3");
}
LAB 1 Generic 4 (Fahrenheit to Celsius program)
void setup(){
float fahrenheit = 85.0;float celsius;
celsius = (fahrenheit-32)*5/9;
println("***Fahrenheit to Celsius program***");
println("Fahrenheit = "+fahrenheit+" degree");
println("Celsius = "+celsius+" degree");
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น