Sounds more like you're trying to construct a string of repeating numbers than doing actual math. Why not do the following (C#)?
using System;
using System.Text;
public int CreateInt(int x, int N)
{
StringBuilder createdString = new StringBuilder();
int createdInt;
for (int i = 0; i < N; i++)
createdString.Append(x.ToString());
if (!int.TryParse(createdString.ToString(), out createdInt))
throw new Exception(string.Format("Value x ({0}) repeated N ({1}) times makes {2}. This is not a valid integer.", x, N, createdString));
return createdInt;
}
int createdInt1 = CreateInt(7, 5); // output: 77777
int createdInt2 = CreateInt(14, 4); // output: 14141414
int createdInt3 = CreateInt(1, 20); // output: throws exception "Value x (1) repeated N (20) times makes 11111111111111111111. This is not a valid integer."
This sample shows a couple of things you'll wanna watch out for:
- Is the created result a valid integer for whatever language you're programming in?
- What if the integer to repeat (x) is double digits or higher?