C language exercise - beginner
-
Solve in C language: 1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?" 2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
-
Solve in C language: 1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?" 2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
And what is your question?
-
Solve in C language: 1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?" 2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
as a starter, I give you the 'compute_interest' skeleton. To complete it is up to you
double compute_interest(double deposit, int months)
{
double interest;
// TODO: compute the result here
return interest;
}"In testa che avete, Signor di Ceprano?" -- Rigoletto
-
Solve in C language: 1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?" 2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
At this rate, you might want to plan on staying a beginner. :rolleyes:
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Solve in C language: 1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?" 2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
Senhor League wrote:
Then make B increment by a drive and repeat the 4 operations
What does that mean? Is it a quirk of Google Translate? Based on the language that I thought seemed reasonable given your CP username, I tried Google translate from English to Portuguese (Em seguida, faça o incremento B por uma unidade e repita as 4 operações) and back to English. That gives "Then increment B by one unit and repeat the 4 operations." - that makes more sense.
-
Senhor League wrote:
Then make B increment by a drive and repeat the 4 operations
What does that mean? Is it a quirk of Google Translate? Based on the language that I thought seemed reasonable given your CP username, I tried Google translate from English to Portuguese (Em seguida, faça o incremento B por uma unidade e repita as 4 operações) and back to English. That gives "Then increment B by one unit and repeat the 4 operations." - that makes more sense.
Maybe Google Translate tried to solve it and encountered a divide by zero error.
-
Solve in C language: 1: "A savings account was opened with a deposit of $500.00. Imagine that this account is paid at 1% interest per month. What will the account value be after three months?" 2: "Make a program with 2 variables, A and B, where A will have the value 40 and B will have the value -1. Print the value of A+B, A-B, AxB and A/B. Then make B increment by a drive and repeat the 4 operations."
The question is: Do you seriously want to learn how to become an IT specialist, who can code, or are you more interested in the party type student life. The problems you want resolved are quite trivial, and I could easily write you the required lines. However, I will not! You seem to be early in your course. I have no doubt that your college provided you with the resources required where you can find out how to write this code. Read it, and Try it out, fail and Learn. Writing Code is about Trying and Learning, the whole time. You write the Code, Compile it. You get Compiling errors. That means that the Compiler does not understood what you wrote. Solve them, it Compiles. Now you have a running program or App. Does the App do what you want it to do! Very Often it does not. They call that Debugging! I learned C and CPP/MFC the hard way. By myself, trial and error. My University simply did not have a computer that students could work with in 1974. My first computer was a Commodore 64 in 1985, where I learned the beginnings of Machine Code and ASM programming. A small PC with a C Compiler came as a godsend, and at the time I was in no doubt what compilers linkers, and debug/retail versions did and could do. You have an institution with resources behind you. Use those resourses and learn. Stop asking this forum to resolve your exam questions. Believe it or not, Everybody on this forum has met intractable issues, All of us have been students, one way or the other. We deal with real science here. Helping you to spoof your exam is never a way forward.
Bram van Kampen
-
Maybe Google Translate tried to solve it and encountered a divide by zero error.
I think you are a bit harsh! We all had to learn! Maybe Codeproject should start a Beginners Page
Bram van Kampen
-
I think you are a bit harsh! We all had to learn! Maybe Codeproject should start a Beginners Page
Bram van Kampen
Bram van Kampen wrote:
I think you are a bit harsh! We all had to learn!
Indeed we did, and for many of us there was no internet to help. But there seems to be an attitude among a number of students (I assume a minority) these days that they do not have to put any actual effort into learning. We get regular questions in QA of this type, which at best are, "please do my assignment". Some of them even use the excuse that they don't have time to learn, or it must be ready by tomorrow at the latest.