Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Handling and error management. #1

Open
RajS18 opened this issue Oct 3, 2020 · 1 comment
Open

Exception Handling and error management. #1

RajS18 opened this issue Oct 3, 2020 · 1 comment

Comments

@RajS18
Copy link

RajS18 commented Oct 3, 2020

Greetings,
Can i please contribute to the repository.
Aim: "Exception Handling and error management."

@muratxx61
Copy link

I added function return to the project ,

/*###################################################

Body Mass Index (BMI) Calculator

Copyright (c) 2008 - 2018 Junian Triajianto

Tested on 20.09.2021 by MK

###################################################*/

#include
#include

// function decleration and calculation 	
float BMI_Calc (float A,float B)
{
	return A*10000/(B*B);
}

char toUpperChar (char x);

int main()
{
char r;
float TB, IMT, BMI;
int BB;

do
{
  
printf("\n\nBody Mass Index (BMI) Calculation \n");
printf("==================================\n\n");
printf("BW	 : Weight (kg)\n");
printf("BH   : Height (cm)\n");
printf("BMI  : Body Mass Index\n\n");
printf("BW   : ");
scanf("%d", & BB);
printf("BH   : ");
scanf("%f", & TB);
IMT= BB/(TB*TB)*10000;
printf("BMI  : %0.2f\n\n", IMT);
printf("You are ");

// call Function 
BMI= BMI_Calc(BB,TB);


if (BMI<18.5)
	printf("Underweight");
else if (BMI<23)
	printf("Normal Weight");
else if (BMI<25)
	printf ("Overweight");
else if (BMI<30)
	printf("Obesity");
else
	printf("Over obesity");
	
printf("\n\n Try again[Y/N]? ");


  do 
  {
  	r=getchar();
  	r= toUpperChar(r);
	
	}while (r!='Y' && r!='N');

}while (r=='Y');
}

char toUpperChar (char x)
{
	if (x>= 97 && x<= 122) x=x-32;
	return x;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants