By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,919 Members | 1,587 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,919 IT Pros & Developers. It's quick & easy.

Display weighted sum

P: 1
Write a program which, given a four digit number, displays the weighted sum of the number. The
weighted sum of a number is the total of multiplying each digit by its position in the number (counting from the left and starting from 1). For example, given the four digit number 2756 we calculatetheweightedsumofdigitsas: 2*1+7*2+5*3+6*4 whichequals55.
Paste the following statement into your program.
number = 1742 #Make changes to this number to test you program
The program prints the four digit number followed by "Weighted Sum: " followed by the weighted sum.
For example: 1742 Weighted sum: 35
Aug 11 '17 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 3,503
If you are stuck in your code and having a problem getting it to provide a correct answer, feel free to provide your code here (in code tags), and someone will assist you. But please do not expect us to do your homework for you.
Sep 5 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.