Skip to content

Instantly share code, notes, and snippets.

@sachinsaxena25
Last active July 18, 2019 18:24
Show Gist options
  • Save sachinsaxena25/7453b04248c4ec0b21aff90ea0460fb6 to your computer and use it in GitHub Desktop.
Save sachinsaxena25/7453b04248c4ec0b21aff90ea0460fb6 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(void){
float principle_amount = 0.0f;
float time = 0.0f;
printf("please enter the principle_amount:\n");
scanf("%f", &principle_amount);
printf("please enter the time duration:\n");
scanf("%f", &time);
if(time > 10.0f)
printf("%.2f", principle_amount * time * 8.0f / 100.0f);
else
printf("%.2f", principle_amount * time * 12.0f / 100.0f);
return 0;
}
@dbc2201
Copy link

dbc2201 commented Jul 18, 2019

  1. Use printf("%.2f", principle_amount * time * 8.0f / 100.0f); and printf("%.2f", principle_amount * time * 12.0f / 100.0f);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment