Home > Net >  C # small white hit
C # small white hit

Time:09-28

2 do homework, really can't find ideas currently only learn if the Boolean expression feeling ideas are hard to find at this stage is thinking of using the if to determine a few digits [such as a<9999 & amp; & amp; a> 10000], but don't know how to use a judge later 10 million show them one by one and output [format single-digit is x, ten digits is x...] , have a great god know

CodePudding user response:

The static void Main (string [] args)
{
Up:
Console. WriteLine (" please enter an integer to identify ");
Int a=the Convert. ToInt32 (Console. ReadLine ());
Int wan=0;
Int qian=0;
Int bai=0;
Int shi=0;
Int ge=0;
If (a<0 | | a> 99999)
{
Console. WriteLine (" input error, please enter again ");
Goto up;
}
Else if (a & lt; 100000 & amp; & A. & gt;=0)
{
If (a/10000 & gt; 0)
{
Console. WriteLine (" numerical ten thousand is a "+ a/10000);
Wan=a/10000;
Qian=(a - wan * 10000)/1000;
Bai=(a - 10000 - qian wan * * 1000)/100;
Shi=(a - 10000 - qian wan * * 1000 - bai * 100)/10;
Ge=a - 10000 - qian wan * * 1000-100 - shi bai * * 10;
Console. WriteLine (" ten thousand "+ wan +" one thousand "+ qian," one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000 & gt; 0)
{
Qian=a/1000;
Bai=(a - qian * 1000)/100;
Shi=(a - 1000 - bai qian * * 100)/10;
General electric (ge)=a - qian * 1000-100 - shi bai * * 10;
Console. WriteLine (" one thousand "+ qian +" one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000==0 & amp; & A/100 & gt; 0)
{
Bai=a/100;
Shi=(a - bai * 100)/10;
Ge=a - 100 - shi bai * * 10;
Console. WriteLine (" one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000==0 & amp; & A/100==0 & amp; & (a/10 & gt; 0))
{
Shi=a/10;
General electric (ge)=a - shi * 10;
Console. WriteLine (" ten is "+ shi +" bits is "+ ge);
}
The else
{
Ge=a;
Console. WriteLine (" bits is "+ ge);
}
}
Console.ReadKey();
}

CodePudding user response:

reference 1st floor jf1125jh response:
static void Main (string [] args)
{
Up:
Console. WriteLine (" please enter an integer to identify ");
Int a=the Convert. ToInt32 (Console. ReadLine ());
Int wan=0;
Int qian=0;
Int bai=0;
Int shi=0;
Int ge=0;
If (a<0 | | a> 99999)
{
Console. WriteLine (" input error, please enter again ");
Goto up;
}
Else if (a & lt; 100000 & amp; & A. & gt;=0)
{
If (a/10000 & gt; 0)
{
Console. WriteLine (" numerical ten thousand is a "+ a/10000);
Wan=a/10000;
Qian=(a - wan * 10000)/1000;
Bai=(a - 10000 - qian wan * * 1000)/100;
Shi=(a - 10000 - qian wan * * 1000 - bai * 100)/10;
Ge=a - 10000 - qian wan * * 1000-100 - shi bai * * 10;
Console. WriteLine (" ten thousand "+ wan +" one thousand "+ qian," one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000 & gt; 0)
{
Qian=a/1000;
Bai=(a - qian * 1000)/100;
Shi=(a - 1000 - bai qian * * 100)/10;
General electric (ge)=a - qian * 1000-100 - shi bai * * 10;
Console. WriteLine (" one thousand "+ qian +" one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000==0 & amp; & A/100 & gt; 0)
{
Bai=a/100;
Shi=(a - bai * 100)/10;
Ge=a - 100 - shi bai * * 10;
Console. WriteLine (" one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000==0 & amp; & A/100==0 & amp; & (a/10 & gt; 0))
{
Shi=a/10;
General electric (ge)=a - shi * 10;
Console. WriteLine (" ten is "+ shi +" bits is "+ ge);
}
The else
{
Ge=a;
Console. WriteLine (" bits is "+ ge);
}
}
Console.ReadKey();
}

Thanks for brother, you see, a very simple and clear code, and to have the goods, thank you

CodePudding user response:

refer to the second floor AFCxiaobai response:
Quote: refer to 1st floor jf1125jh response:
static void Main (string [] args)
{
Up:
Console. WriteLine (" please enter an integer to identify ");
Int a=the Convert. ToInt32 (Console. ReadLine ());
Int wan=0;
Int qian=0;
Int bai=0;
Int shi=0;
Int ge=0;
If (a<0 | | a> 99999)
{
Console. WriteLine (" input error, please enter again ");
Goto up;
}
Else if (a & lt; 100000 & amp; & A. & gt;=0)
{
If (a/10000 & gt; 0)
{
Console. WriteLine (" numerical ten thousand is a "+ a/10000);
Wan=a/10000;
Qian=(a - wan * 10000)/1000;
Bai=(a - 10000 - qian wan * * 1000)/100;
Shi=(a - 10000 - qian wan * * 1000 - bai * 100)/10;
Ge=a - 10000 - qian wan * * 1000-100 - shi bai * * 10;
Console. WriteLine (" ten thousand "+ wan +" one thousand "+ qian," one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; & A/1000 & gt; 0)
{
Qian=a/1000;
Bai=(a - qian * 1000)/100;
Shi=(a - 1000 - bai qian * * 100)/10;
General electric (ge)=a - qian * 1000-100 - shi bai * * 10;
Console. WriteLine (" one thousand "+ qian +" one hundred "+ bai +" ten is "+ shi +" bits is "+ ge);
}
Else if (a/10000==0 & amp; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related