Created
November 11, 2016 07:13
-
-
Save olecksamdr/a166cdcd92ce6ed3e849ab1221d296f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace numbersTogather_2 | |
{ | |
class Program | |
{ | |
static int getAB(int a, int b) | |
{ | |
return int.Parse(a.ToString() + b.ToString()); | |
} | |
public class myCounter | |
{ | |
int _number; | |
int posToReplace = 1; | |
string current; | |
public myCounter() | |
{ | |
_number = 0; | |
current = _number.ToString(); | |
} | |
public string getNext() | |
{ | |
if (_number % 10 == 0 && _number != 0) | |
{ | |
current = _number.ToString(); | |
int len = current.Length - 2; | |
current = current.Remove(len, 1).Insert(len, "0"); | |
_number++; | |
return current; | |
} | |
current = (_number).ToString(); | |
_number++; | |
return current; | |
} | |
} | |
static void Main(string[] args) | |
{ | |
myCounter counter = new myCounter(); | |
for (int i = 0; i < 101; i++) | |
{ | |
Console.WriteLine(counter.getNext()); | |
} | |
/* Console.WriteLine("Enter A natural number"); | |
int a = int.Parse(Console.ReadLine()); | |
Console.WriteLine("Enter C natural number"); | |
int c = int.Parse(Console.ReadLine()); | |
int prevVal = 0; | |
int b = 0; | |
int ab = getAB(a, b); | |
while (ab % c != 0) | |
{ | |
ab = getAB(a, ++b); | |
} | |
Console.WriteLine("A = {0}; \nB = {1}; \nAB = {2}; \nAB mod C = {2} mod {3}", a, b, ab, c); | |
Console.ReadLine(); | |
*/ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment