I am asked to do this
"Ask the user to enter an integer greater than 1000. Remove the final digit. If the resulting integer is evenly divisible by 3 or 5 or 9, divide it modulo by 7 and add the result into a variable named special, otherwise divide it modulo by 8 and add the result into a variable named normal."
my code
#include <iostream>
using namespace std;
int main()
{
int number, newnumber;
double finalnumber,special, normal;
cout << "Please enter a number greater than 1000." << endl;
cin >> number;
newnumber = number / 10;
if (newnumber % 3 == 0 || newnumber % 5 == 0 || newnumber % 9 == 0)
{finalnumber = newnumber % 7;
special = finalnumber;
}
else
{finalnumber = newnumber % 8;
normal = finalnumber;
}
cout << finalnumber << endl;
return 0;
}
what am i doing wrong? im getting whole intergers for answers that make no sense.
What would be the correct answer for 1100 then?
removing the final digit gives 110
110 is evenly divisible by 5, so you divide it by 7 and take the remainder, which is 5...