## Get Each Digits of Number with Using Loops in C++

I need a program same as I wrote but using loops. (if else for etc.) . Program is that enter a number and get each digits of number like that: number is 123456. I’m beginner, I can’t create the logic and can’t combine loops. Can anybody help me about that situation?

``````1.digits is 6
2.digits is 5
3.digits is 4
4.digits is 3
5.digits is 2
6.digits is 1
7.digits is 0
8.digits is 0
9.digits is 0
``````

.

``````#include <iostream>
using namespace std;

int main()
{
int number,first,second,third,fourth,fifth,sixth,seventh,eighth,ninth;

cout<< "Enter a number (<999999999): " << endl;

cin>>number;

first = number%10;
second = number/10%10;
third = number/100%10;
fourth = number/1000%10;
fifth = number/10000%10;
sixth = number/100000%10;
seventh = number/1000000%10;
eighth = number/10000000%10;
ninth = number/100000000%10;

cout<<"1. digit is"<<" "<<first<<endl;
cout<<"2. digit is"<<" "<<second<<endl;
cout<<"3. digit is"<<" "<<third<<endl;
cout<<"4. digit is"<<" "<<fourth<<endl;
cout<<"5. digit is"<<" "<<fifth<<endl;
cout<<"6. digit is"<<" "<<sixth<<endl;
cout<<"7. digit is"<<" "<<seventh<<endl;
cout<<"8. digit is"<<" "<<eighth<<endl;
cout<<"9. digit is"<<" "<<ninth<<endl;

return 0;
}
``````

## equation solving – How to change Machine Precision digits to meet the tolerances

I am trying to solve for Tcm and Mag by solving nonlinear equations using FindRoot command using following code:

``````Tc0 = 1;
rg = Rationalize@0.057375;
ratio = Rationalize@0.1;
(CapitalGamma)0 = rg 2 (Pi) Tc0;
(CapitalGamma)p = ratio (CapitalGamma)0;
(CapitalGamma)t  =  (CapitalGamma)0 + (CapitalGamma)p;
nMax  = 10000;
Ts = Rationalize@1.02758;
Tc = Rationalize@0.942857;

(*Fourth order algebraic equation for gwn*)
{sol1(n_, Mag_, Tcm_) , sol2(n_, Mag_, Tcm_)  , sol3(n_, Mag_, Tcm_)  ,
sol4(n_, Mag_, Tcm_)  } =
gwn /. Solve(
1/gwn^2 == 1 + Mag^2/((2 n + 1) Pi Tcm + 2 (CapitalGamma)t  gwn )^2,
gwn);

(*Equation for Tcm*)
sumArg4Tcm(n_, Mag_, Tcm_)  =
2 Pi Tcm (2 n +
1) Pi Tcm (sol4(n, Mag, Tcm ) - 1)/((2 n + 1) Pi Tcm +
2 (CapitalGamma)p )/((2 n + 1) Pi Tcm +
2 (CapitalGamma)p  sol4(n, Mag, Tcm ) );
target1Tcm(Tcm_) =
Log(Tcm/Tc) + PolyGamma(1/2 + (CapitalGamma)p/((Pi) Tcm)) -
PolyGamma(1/2 + (CapitalGamma)p/((Pi) Tc));

myTrial4Tcm(Mag_?NumericQ, Tcm_?NumericQ) :=
Parallelize(Sum(sumArg4Tcm(n, Mag, Tcm ) , {n, 0, nMax}) ) // Chop;

(*Equation for Mag*)
sumArg4Mag(n_, Mag_, Tcm_)  =
2 Pi Tcm (2 n +
1) Pi Tcm (sol4(n, Mag, Tcm ) - 1)/((2 n + 1) Pi Tcm +
2 (CapitalGamma)t )/((2 n + 1) Pi Tcm +
2 (CapitalGamma)t  sol4(n, Mag, Tcm ) );
target1Mag(Tcm_) =
Log(Tcm/Ts) + PolyGamma(1/2 + (CapitalGamma)t/((Pi) Tcm)) -
PolyGamma(1/2 + (CapitalGamma)t/((Pi) Ts));
myTrial4Mag(Mag_?NumericQ, Tcm_?NumericQ) :=
Parallelize(Sum(sumArg4Mag(n, Mag, Tcm ) , {n, 0, nMax})  ) // Chop;

AbsoluteTiming(FindRoot({Re(myTrial4Tcm(Mag, Tcm) - target1Tcm(Tcm)), Re(myTrial4Mag(Mag, Tcm) - target1Mag(Tcm))}, {Mag, 2.28}, {Tcm, 0.235},
WorkingPrecision -> 10))
``````

Running above code gave me an error

The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

Then I used options WorkingPrecision -> 10 but also gave me same error.

Can someone help me to get the right value?

## array – JavaScript app Translator app (digits to German and French)

I was asked to make a simple translator in JavaScript that translates a number between 1 and 30 to German or French.

The app should :

-Ask the user to type a digit between 1-30 (alert an error message if the user does not enter a number)

-Ask the user to type French or German (Alert an error message if the user does not enter those options)

-Translate the chosen number in the chosen language and output the translation.

-The output should say “The Translation is xx press any key to translate again”

I am very new to this and am currently stuck trying to figure out what is the most simple way of making the translation work without too much issues and be clean.

here is what I have so far please note this is INCOMPLETE.

Any advice and tips are welcome.

`````` //Prompt user to type a number between 1 and 30
var number = prompt(" Please Type a number from 1 to 30 ?");

// Verify if number is between 1 and 30
while (number > 30){

// If number is not between 1 and 30 display error
alert ("Please enter a number between 1 and 30 !");
prompt ("Type a number from 1 to 30 ?");

// Do not create an infinite loop by incrementing
number++;
}

// Prompt user to type French or German
var language = prompt ("Please Type German or French ?") ;

//Translate to French
function French(number,french){
var number = (1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ;
var french = ("Un","Deux","Trois","Quatre","Cinq","Six","Sept","Huit","Neuf","Dix","Onze","Douze","Treize","Quatorze","Quinze","Seize","Dix-Sept","Dix-Huit","Dix-Neuf","Vingt",Vingt et un","Vingt-Deux","Vingt-Trois","Vingt-Quatre","Vingt-Cinq","Vingt-Six","Vingt-Sept","Vingt-Huit"-"Vingt-Neuf"-"Trente") ;

return translatedNumber;
}

//Translate to German
function German(number,german){
var number = (1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30) ;
var german = ("Eins","Zwei","Drei","Vier","Fünf","Sechs","Sieben","Acht","Neun","Zehn","Elf","Zwölf","Dreizehn","Vierzehn","Fünfzehn","Sechzehn","Siebzehn","Achtzehn","Neunzehn","Zwanzig","Einundzwanzig","Zweiundzwanzig","Dreiundzwanzig","Vierundzwanzig","Fünfundzwanzig","Sechsundzwanzig","Siebenundzwanzig","Achtundzwanzig","Neunundzwanzig","Dreißig");

return translatedNumber;
}
``````

## theming – Escaping CSS digits, 0 is removed from CSS aggregated files

The following HTML markup won’t work on a production site.

``````<div class="iconleft 109">TEXT</div>
``````

This is the code in the custom.css file.

``````.iconleft.31 09,
.iconleft.31 12,
.iconleft.31 10,
.iconleft.31 11,
.iconleft.31 20 {
background: #B0CD00;
}
``````

`.iconleft.31 09` works on localhost with xampp and no aggregation. On the production site, where Advanced CSS/JS Aggregation is activated, it wont work for 109.

In the aggregated CSS file, I see `.iconleft.31 9` as CSS class. It seems that 0 has been removed.

Do you have any hint?

## theming – Escaping CSS digits – Drupal removes 0 from css aggregated file

the following css code wont work on production site:

``````<div class="iconleft 109">TEXT</div>
``````

Thats the code in my custom.css file

``````.iconleft.31 09,
.iconleft.31 12,
.iconleft.31 10,
.iconleft.31 11,
.iconleft.31 20 {
background: #B0CD00;
}
``````

.iconleft.31 09 works on localhost with xampp and no aggregation.

On prodction site where Advanced CSS/JS Aggregation is activated it wont work for 109!

In the aggregated css file i see the following class: .iconleft.31 9

It seems that 0 is removed.

Any hints? Thank you!

## nt.number theory – Can digits of real irrational number be contained in digits of real irrational number?

We have the following cases:

1]Digits of algebraic real irrational number be contained in digits of transcendental real irrational number.

2]Digits of algebraic real irrational number be contained in digits of algebraic real irrational number.

3]Digits of transcendental real irrational number be contained in digits of algebraic real irrational number.

4]Digits of transcendental real irrational number be contained in digits of transcendental real irrational number.

I answered the question for case 1 as following:

We know that digits of algebraic real irrational number can’t be contained in transcendental real number because for example :

If we want $$sqrt2$$ be contained in $$pi$$ then $$pi=frac{a}{10^n}+frac{sqrt2}{10^{n+1}}$$ for $$a,n in mathbb{N}$$ which is algebraic number … contradicting that $$pi$$ is transcendental .

Also the third case it is not right because algebraic number would equal transcendental number by similar approach of first case.

So what about other cases?

## nt.number theory – Integers having the same digits as their prime factors

Say an integer is “digitally conservative” in base $$b$$ if the set of its digits coincides with the set of the digits of its prime factors, like $$37127=137times 271$$ in base $$10$$, and denote by $$Dig_{b}(x)$$ the number of such integers not exceeding $$x$$. Can one give an asymptotics for the latter?

## I want to block spam calls. The first six digits are the same but the last four keep changing. The first six digits are legitimate?

I get numerous calls that begin with 289 600 followed by the last 4 digits that keep changing.

So, I can not block using the first six digits. Will it be impossible then to block these spam calls which are supposedly coming from US Border control and strangely enough the same call also refers to Service Canada

I live in Ontario Canada and my cell # begins with 289 600

Thanks

Duncan

## sharepoint online – filter column with last 4 digits using restapi

SharePoint REST API does not support `endswith`, Source.

If you want to filter using `substringof`, you can use your query like below:

``````<siteUrl>/_api/Web/Lists/getByTitle('ListName')/items?\$select=QuoteNo&\$filter=substringof('9817',QuoteNo)
``````

No need to surround column name by `''`.

Note: This endpoint will return all the items which contains `9817` anywhere in `QuoteNo` column and not only at the end.

If you want to filter the items by “endwith” (last 4 digits) condition, you have to do that client side using JavaScript after fetching all items from list.

Here’s working example of passing column name & value to filter dynamically. You can refer this code & make changes in your code accordingly:

``````<script type="text/javascript" src="https://sharepoint.stackexchange.com/sites/SPConnect/SiteAssets/jquery.min.js"></script>

<button type="button" onclick="getListItems('ChildList')"> Get List Items</button>

<script type="text/javascript">
function getListItems(listName) {
var columnName = "Title";
var columnValue = "Child 1";

var itemsEndpoint = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items?\$select=" + columnName + "&\$filter=substringof('" + columnValue + "'," + columnName + ")";

\$.ajax({
url: itemsEndpoint,
type: "GET",
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
},
success: function (data) {
console.log(data);
},
error: function (error) {
console.log(error);
}
});
}
</script>
``````

## co.combinatorics – How many three-digit even numbers can be obtained from digits 1,2,3,4,5

This seems to be a very simple task, but I don’t know how it can be solved.

I have a lot of numbers: {1, 2, 3, 4, 5}. I need to calculate how many even 3-digit numbers I can get from these numbers.
The numbers in the number must not be repeated.

The first thing I want to do in this situation is to find the number of numbers that I can make up under a given condition.

It’s easy: 5 * 4 * 3 = 60

These are all numbers, but I only want the even ones.
For an hour now I have been unable to figure out how to solve this problem – even though it is simple.

I used an online application that generated all these 60 numbers, including 24 even ones.
If necessary, I will post it.

The question is: how to solve this problem mathematically?