Display weighted sum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Guru425
    New Member
    • Aug 2017
    • 1

    Display weighted sum

    QUESTION - DISPLAY THE WEIGHTED SUM
    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 calculatethewei ghtedsumofdigit sas: 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
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    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.

    Comment

    Working...