This is the assignment:
Create a program to calculate the product of the last digit integers from 100 to n , where the program first asks for integer .
Program should look like :
Enter number: 5
Entered number multiple of the last digit 100 to 105 is 120
Can anyone show me some way to solve this please I've looked for solutions but nothing
Can anyone show me some way to solve this please I've looked for solutions but nothing
Hard work, study, reading your notes, revision are always good places to start. Follow that up with an attempt you can show us, even if it is just in general terms of how you plan to tackle it, is often a good move here too.
General questions like 'show me how to do it' are not the best move here because you probably need to talk to your teacher or tutor because they like to know if they have missed something or are being unreasonable.
By all means come up with something we can 'poke a stick at' and you'll be overwhelmed almost with the eagerness people here have to help a genuine trier.
You should start doing it and when you're stuck you should come ask. This way you learn much faster. Try writing some of the code, we will be here if you have any questions
But what happens when the entered number is 10? Will the result be zero as you are multiplying by the last interger which is 0? If so all the numbers after that will also be zero? Or am I being hard on the head? lol
#include <iostream>
usingnamespace std;
int main()
{
int n = 0;
int x1 = 100;
int x2 = 0;
cout <<"Enter number: " <<endl;
cin >> n ;
x2 = x1 + n;
//cout << "Entered number multiple of the last digit " << x1 << " to " << x2 << " is " <<what<< endl;
// declare int product and set to 1
// for all numbers i between x1 and x1 + n
// get the last digit of i
// multiply that last digit by product
// keep going in loop until finished
return 0 ;
}
Also, as a hint use C++ modular arithmetic to get the last digit, and remeber if the last digit is zero the product will be zero regardless of how many factors are involved.
I think that the google translator messed the question, maybe i know your language, is it spanish or portuguese? If so you can put the question in that language and I can help you better.
Also kemort, would you mind telling who the reporter is or what did I do wrong?
The product of two numbers 'a' and 'b' is 'a x b', eg if a = 3 and b = 7, the product of a and b is 7 x 3 = 21
Using the example, the 5 numbers starting at x1 = 101 are 101, 102, 103, 104 and 105. The corresponding last digits extracted from those are 1, 2, 3, 4, and 5. The rest follows.
No its not to the power of its factorial, its represented with a number and this ! after the number. For example 5 factorial would be 5!, and also is the same with 1*2*3*4*5.
Yes, a for loop and i int and some conditions are an excellent idea.
First just get the value for n and print out the numbers in the range of values using you new loop. Leave the last digit calculation out until you get that part right.
Also, only concern yourself with multiplying the numbers, factorials and powers have nothing to do with this problem. :)
Leave this assignment for experts http://acewriters.org/ - just make sure your questions are to the point, and not of the "this is my homework, please solve it for me" nature so common in homework questions. Experienced programmers don't have much patience for the latter, because it shows the question's author isn't really trying to learn anything.
Try showing what have you done so far with your assignment and explaining which specific parts of it you have problems with or can't understand.