guys got some problems with regards to c# programming im new with this one..
my problem is displaying 5 integers or numbers that is having a 3 spaces in between the numbers..
want some of your codes.. thanks a lot guys... Happy new year
guys got some problems with regards to c# programming im new with this one..
my problem is displaying 5 integers or numbers that is having a 3 spaces in between the numbers..
want some of your codes.. thanks a lot guys... Happy new year
Hi Ugaton, welcome at Daniweb!
We are all very eager around here to help you out, but what we all like is some effort from your side.
What is the code you got so far? What have you tried for yourself? It is like they say in that song I heard lately : "chewing bubblegum never solved an algebraic equation..."
Hi Ugaton, welcome at Daniweb!
We are all very eager around here to help you out, but what we all like is some effort from your side.
What is the code you got so far? What have you tried for yourself? It is like they say in that song I heard lately : "chewing bubblegum never solved an algebraic equation..."
got this only bro...
string a;
int a1=1;
Console.WriteLine("Enter numbers");
a = Console.ReadLine();
a1 = Int32.Parse(a);
while (a1 <= 99999)
{
{
Console.WriteLine("{0}", a1);
Console.ReadLine();
}
}
Console.WriteLine("Please enter 5 numbers only");
Console.ReadLine();
for now im still working on this one... this will only get 5 numbers.
but i cant split it to have 3 spaces in between.. thanks for the reply.. i guess my codes is far from REALITY.!! ahehehe.. im just trying this one.. wanna help me up again? thanks
Of course we will help you!:)
But if you post code, put it between code tags! See the
[/B]mark on top of your posting window.
Well your code is not that bad, it shows very well yu are willing to learn.
Here is my solution. If you have questions : ask!
[CODE=c#]static void Main(string[] args)
{
//string a;
//int a1 = 1;
//Console.WriteLine("Enter numbers");
//a = Console.ReadLine();
//a1 = Int32.Parse(a);
//while (a1 <= 99999)
//{
// {
// Console.WriteLine("{0}", a1);
// Console.ReadLine();
// }
//}
//Console.WriteLine("Please enter 5 numbers only");
//Console.ReadLine();
// gave a meaningfull name to my variable instead of naming it "a"
// initialized it to empty by using a method of the string class
string OutputString = string.Empty;
Console.WriteLine("Enter numbers");
// because we have exactly 5 numbers we can use a for loop
for (int i = 0; i < 5; i++)
{
OutputString = OutputString + Console.ReadLine() + " "; // 3 spaces
}
Console.WriteLine(OutputString.Trim()); // trimmed of the last 3 spaces
Console.ReadKey(); //keep console on screen in debug mode
}
Of course we will help you!:)
But if you post code, put it between code tags! See the[/B]mark on top of your posting window. Well your code is not that bad, it shows very well yu are willing to learn. Here is my solution. If you have questions : ask! [CODE=c#]static void Main(string[] args) { //string a; //int a1 = 1; //Console.WriteLine("Enter numbers"); //a = Console.ReadLine(); //a1 = Int32.Parse(a); //while (a1 <= 99999) //{ // { // Console.WriteLine("{0}", a1); // Console.ReadLine(); // } //} //Console.WriteLine("Please enter 5 numbers only"); //Console.ReadLine(); // gave a meaningfull name to my variable instead of naming it "a" // initialized it to empty by using a method of the string class string OutputString = string.Empty; Console.WriteLine("Enter numbers"); // because we have exactly 5 numbers we can use a for loop for (int i = 0; i < 5; i++) { OutputString = OutputString + Console.ReadLine() + " "; // 3 spaces } Console.WriteLine(OutputString.Trim()); // trimmed of the last 3 spaces Console.ReadKey(); //keep console on screen in debug mode }
WOW!!!!!!!!!! thanks a lot.!!! Your a Genius.
sir can i have a favor? how can i make this like entering an output in a simultaneous way? and directly it will split the 5 numbers to have 3 spaces?
sir thanks a lot again...
Don't call me a genius, I'm not. Perhaps it is common in your culture to call me sir, but I like to be called Danny, the guy from accross the street.
Here is a new version:
// gave a meaningfull name to my variable instead of naming it "a"
// initialized it to empty by using a method of the string class
string OutputString = string.Empty;
string InputString = string.Empty;
Console.WriteLine("Enter numbers");
while (true)
{
InputString = Console.ReadLine();
if (InputString == "99999") break; // step out
OutputString = OutputString + InputString + " "; // 3 spaces
Console.WriteLine("{0}", OutputString);
}
Console.ReadKey(); //keep console on screen in debug mode
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.