I need to make a program that calculates the area of a circle but I have to use an int, char, and float. No matter what I do though I can't get the second and third variables to output meaningful values, only the first. This is what I have written down so far.
Code:
#include <stdio.h>
#include "conio.h"
#define PI 3.14159
int main()
{
/* The following is a program to demonstrate several different c numerical input funtions:interger, float, character.*/
float radius1, area_float; //declares the radius that will be used for float
int radius, area_int;
char radius3, area_char;
printf("Input radius for float, please? "); // Promts the user to enter a value for float
scanf("%f", &radius1 ); // obtains the value from the float promt
area_float = PI * radius1 * radius1; //Equation for area of a cricle
printf("area1 = %f\n", area_float); //Prints the answer for float
//Forces the command console to pause because c is used.
printf("Input radius for int value, please? ");
area_int = PI * radius * radius;
scanf("%d", &radius );
printf("area2 =%d\n", area_int);
_getch();
printf("Input radius for char value, please? ");
scanf("%c", &radius3);
area_char= PI * radius3*radius3;
printf("area3 =%c2\n", area_char);
_getch();
return 0;
}
I'm not sure what to do and I've been working on this for hours Thanks for any help or advice!