Here we have gererated a 9 digit random number whose sum is multiple of 9
and starting no will be 6 and 7
public void GetUnique()
{
string b=Getval();
char[] a=b.tochararray()
int b1=0;
foreach(char v in a)
{
b1+=Convert.ToInt32(v);
}
if (b1%9==0)
{
print value;
}
else
GetUnique() ;
}
public string Getval()
{
Random r = new Random();
string b = String.Format
(
"{0}{1}{2}{3}{4}{5}{6}{7}{8}",
r.Next(6, 7),
r.Next(0, 9),
r.Next(0, 9),
r.Next(0, 9),
r.Next(0, 9),
r.Next(0, 9),
r.Next(0, 9),
r.Next(0, 9),
r.Next(0, 9)
);
return b;
}
Subscribe to:
Post Comments (Atom)
Mat Table Angular
Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...
-
CriteriaOperator criteria = new BinaryOperator("Age", 30, BinaryOperatorType.Greater); CriteriaOperator criteria = CriteriaOperato...
-
SortingCollection sc = new SortingCollection(); sc.Add (new SortProperty("field on which you want to sort",DevExpress.Xpo.DB.Sorti...
-
Minification and Uglyfication in Angular Deployement Minification : While building Angular Application white spaces , unused variable , u...
No comments:
Post a Comment