# include %26lt;stdio.h%26gt;
/*beginning of program*/
main()
{
/* enter the variables that will be used*/
int account,beginning,total,allowed,credit,a...
/*accout number will be inputted*/
printf("Enter Account Number:\n\n");
/*recieves the number inputed from the keyboard*/
scanf("%d", %26amp; account);
/* beginning balance is inputted*/
printf("Enter beginnig balance of the month\n\n$");
/*recieves the number inputed from the keyboard*/
scanf("%d", %26amp; beginning);
/* total charged is asked*/
printf("Enter total charges \n\n$");
/*recieves the number inputed from the keyboard*/
scanf("%d",%26amp; total);
/* ask for the total credit of the card*/
printf("Enter total credits\n\n$");
/*recieves the number inputed from the keyboard*/
scanf("%d",%26amp; allowed);
/* ask for the credit limit of the card*/
printf("Enter credit limit to customer\n\n$");
/*recieves the number inputed from the keyboard*/
scanf("%d", %26amp; credit);
/*adds the beginning balance and credit allowed-credit limit*/
answer= beginning+allowed-credit;
/*prints the remainder from the credit limit*/
printf("Your balance is $%d\n\n", answer);
/*prints account number*/
printf("Account %d\n\n",account);
/*prints allowed credit*/
printf("Allowed is $%d\n\n",allowed);
/*prints the credit remaining*/
printf("Credit is $%d\n\n",credit);
/*shows ifyou have succeed or credit limit or not*/
if(answer %26gt; allowed)
/*prints the answere to the equatio above*/
printf("Credit limit exceeded. sorry sir/madam i'll have to cut your card ha-ha\n\n");
/*end of program*/
}
Can anyone add a loop uising c?
before ur first printf(); statement write
for(int i = 0; i %26lt;= 5; i++)
{
//all ur statements;
}
and include all the statements till ur last printf();
this will repeat all the steps i.e loop 5 times.
Reply:Homework question? There's a different section for that. You're asking someone to do a lot of work for you!
Your question is not clear or concise, you'll never get to be a programmer if you don't learn to spell right, and you need to learn how to work out problems like this without someone giving you the answer. Try opening the textbook, study your class notes a little, and see what happens!
P.S. This is very basic programming. If you don't get this, maybe you're in the wrong major?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment