Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

Really simple C program - trying to collect whether the user has a checking or money market account. I have them enter a number, 1 for Checking, 2 for money market, and then use an if statement to determine which option it is, and print that name. #include int main(void) { int AccountType; printf("Please enter your account type:\n 1. Checking \n 2. Money Market \n\n Account Type: "); scanf("%d", &AccountType); if(AccountType = 1) printf("Your account type is Checking\n"); else printf("Your account type is Money Market\n"); return 0; }

OpenStudy (anonymous):

My problem is that NO MATTER WHAT the user enters it always says it is a checking account. Enter 1, checking. Enter 2, checking. Enter h, checking. I have typed an example out of my book to ensure that works, and it does. This is essentially the exact same thing as that example. Any help would be greatly appreciated.

OpenStudy (jagatuba):

Try changing if(AccountType = 1) TO if(AccountType == 1)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!