473,395 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 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
1 2322
numberwhun
3,509 Expert Mod 2GB
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

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

Similar topics

2
by: Louis | last post by:
Hi, Does anyone know of a script that will give "weighted job duration"? I want to use it, to identify which jobs are hogging the CPU. That is for a given server, list the sql agent jobs...
0
by: Rolan | last post by:
I know what I want to do regarding the average cost for inventory, but need some assistance to sort out some of the details to finalize an inventory table and query. Essentially, the information is...
1
by: HEMH6 | last post by:
Weihted Average Write a C program to calculate and print the weighted average of a list of N floating point number, using the formula Xave = F1X1 + F2X2+...+ FnXn where the F's are...
3
by: Salad | last post by:
http://www.mathwords.com/w/weighted_average.htm At the above link gives an example of a weighted average. It uses the following example: Grades are often computed using a weighted average....
6
by: alessandro.carrega | last post by:
In Igraph library (http://cneurocvs.rmki.kfki.hu/igraph/) there's a method to add a weighted edge?
0
by: edmund_xue | last post by:
Hello There, I was just working on a project of creating a database for a relative that have alots of clients. His company managed the shares portfolio of clients and he requires the buy price...
2
by: LSGKelly | last post by:
I am trying to get the weighted average into my report. I have a query: SELECT qRenPercReptSub.Merged, qRenPercReptSub.ccName, Sum(qRenPercReptSub.countofccname) AS SumOfcountofccname,...
7
by: Yoni Hasid | last post by:
Hello, Hope you can assist me. I am trying to calculate weighted avg in the field based only on certain values. The field contains response ratings received from the survey between 1-5. I am trying...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.