Skip to content

Instantly share code, notes, and snippets.

@ib0b
Created February 26, 2019 11:14
Show Gist options
  • Save ib0b/bb54a67a4e8e8edd69a159b19a7383f3 to your computer and use it in GitHub Desktop.
Save ib0b/bb54a67a4e8e8edd69a159b19a7383f3 to your computer and use it in GitHub Desktop.
assignemnt 1
#include <stdio.h>
#include <stdlib.h>
typedef int bool;
enum { false, true };
int main()
{
char name[50];
int creditScore ;
double workerRate, premiumRate;
bool validCS = false;
printf("Enter Name\n");
gets(name);
while(!validCS){
printf("Enter Credit Score\n");
scanf("%d",&creditScore);
if(creditScore<1 || creditScore>850){
printf("Invalid Credit Score\n");
validCS = false;
}else{
validCS = true;
}
}
//best premium bank
switch(creditScore){
case 720 ... 850 :
premiumRate = 5.79;
break;
case 700 ... 719 :
premiumRate = 5.92;
break;
case 675 ... 699 :
premiumRate = 6.46;
break;
case 620 ... 674 :
premiumRate = 7.61;
break;
case 560 ... 619 :
premiumRate = 8.53;
break;
case 500 ... 559 :
premiumRate = 9.29;
break;
case 0 ... 499 :
premiumRate = 0;
break;
}
//best workerbank
switch(creditScore){
case 750 ... 850 :
workerRate = 5.79;
break;
case 720 ... 749 :
workerRate = 5.92;
break;
case 685 ... 719 :
workerRate = 6.46;
break;
case 610 ... 684 :
workerRate = 7.61;
break;
case 560 ... 609 :
workerRate = 8.53;
break;
case 500 ... 559 :
workerRate = 9.29;
break;
case 430 ... 499 :
workerRate = 9.29;
break;
case 350 ... 429 :
workerRate = 9.29;
break;
case 0 ... 349 :
workerRate = 0;
break;
}
if(premiumRate>workerRate){
printf("The lowest interest rate = %lf is from the Premium Bank \n",premiumRate);
}else{
printf("The lowest interest rate = %lf is from the Worker Bank \n",workerRate);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
typedef int bool;
enum { false, true };
int main()
{
char name[50];
int creditScore ;
double workerRate, premiumRate;
bool validCS = false;
printf("Enter Name\n");
gets(name);
while(!validCS){
printf("Enter Credit Score\n");
scanf("%d",&creditScore);
if(creditScore<1 || creditScore>850){
printf("Invalid Credit Score\n");
validCS = false;
}else{
validCS = true;
}
}
//best premium bank
switch(creditScore){
case 720 ... 850 :
premiumRate = 5.79;
break;
case 700 ... 719 :
premiumRate = 5.92;
break;
case 675 ... 699 :
premiumRate = 6.46;
break;
case 620 ... 674 :
premiumRate = 7.61;
break;
case 560 ... 619 :
premiumRate = 8.53;
break;
case 500 ... 559 :
premiumRate = 9.29;
break;
case 0 ... 499 :
premiumRate = 0;
break;
}
//best workerbank
switch(creditScore){
case 750 ... 850 :
workerRate = 5.79;
break;
case 720 ... 749 :
workerRate = 5.92;
break;
case 685 ... 719 :
workerRate = 6.46;
break;
case 610 ... 684 :
workerRate = 7.61;
break;
case 560 ... 609 :
workerRate = 8.53;
break;
case 500 ... 559 :
workerRate = 9.29;
break;
case 430 ... 499 :
workerRate = 9.29;
break;
case 350 ... 429 :
workerRate = 9.29;
break;
case 0 ... 349 :
workerRate = 0;
break;
}
if(premiumRate>workerRate){
printf("The lowest interest rate = %lf is from the Premium Bank \n",premiumRate);
}else{
printf("The lowest interest rate = %lf is from the Worker Bank \n",workerRate);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment