sorry for adding so mutch so fast, but now ive added a square circumference finder that wont work. when you input the 4 to choose it nothing shows up, even thogh i have stuff typed in there. what is wrong with it?
#include <stdio.h> #include <math.h> int main (void) { float diameter, area, radius, circumference, choice, number1, number2, number3, answer, choice2; char function; printf("MATH HOMEWORK HELPER\n"); printf("------------------------------------\n \n"); printf("Area, Circumference, or Calculater???\n \n 1 = cricumference\n 2 = area\n 3 = square/cube area\n 4 = square circumference\n \n \t - "); scanf("%f", &choice); if (choice == (float)1) { printf("What is the diameter of the circle?\n \n \t - "); scanf("%f", &diameter); circumference = diameter * 3.14; printf("\n \t circumference = %f", circumference); } if (choice == (float)2) { printf("What is the radius of the circle???\n \n \t - "); scanf("%f", &radius); area = (radius * radius) * 3.14; printf("\n \n \t area = %f", area); } if (choice == (float)3) { printf("width of square\n \n \t - "); scanf("%f", &number1); printf("height of square\n \n \t - "); scanf("%f", &number2); printf("is the figure a cube? 1 = yes, 2 = no\n \n \t - "); scanf("%f", &choice2); if (choice2 == (float)1) { printf("length of cube\n \n \t - "); scanf("%f", &number3); answer = number1 * number2 * number3; printf("%f", &answer); } if (choice2 == (float)2) { answer = number1 * number2; printf("%f", &answer); } if (choice == (float)4) { printf("what is the width of the square???\n \n \t - "); scanf("%f", &number1); printf("what is the height of the square???\n \n \t - "); scanf("%f", &number2); answer = (number1 * 2) + (number2 * 2); printf("%f", &answer); } } scanf("%f"); return 0; }
like i said, sory for adding so mutch so fast, but i cant find the problem. and please try to find the bug in the area thing to.
Thanks!!!
matt wuz here
|