ankit.mca.aaidu's Profile User Rating: -----

Reputation: -4 Dishonored
Group:
New Members
Active Posts:
9 (0.01 per day)
Joined:
29-September 12
Profile Views:
209
Last Active:
User is offline Oct 04 2012 04:05 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   ankit.mca.aaidu has not set their status

Posts I've Made

  1. In Topic: Multiplication Tables

    Posted 4 Oct 2012

    View PostNovember-06, on 02 October 2012 - 06:24 PM, said:

    View Postankit.mca.aaidu, on 02 October 2012 - 12:03 AM, said:

    View PostCurtis Rutland, on 01 October 2012 - 07:12 AM, said:

    No, you do not need a 2D array for printing things to the console. Read the link that rfs02 posted, then read this page:

    http://blog.stevex.n...ting-in-csharp/

    That's a super-handy reference for most commonly used string formatting needs. What you're looking for is called "padding". You want each column to take the same amount of space, even if the content inside is of a different size.


    Hello sir please help me with this question . I am just a beginner in this field i want to do thing and i read the tutorial i am not able to implement it, please if you can do some favor to me



    The tutorial is great and really easy to understand. What part is it that you don't understand and having a hard time to implement? Tell us what exactly so we could help.

    Anyway, this is the first time I heard of that alignment in String.Format so I am really impressed and gave the post a plus.

    I changed the \t idea into it so here's my revised code.

                int intProduct = 0;
                for (int intRow = 1; intRow <= 12; intRow++)
                {
                    for (int intColumn = 1; intColumn <= 12; intColumn++)
                    {
                        intProduct = intRow * intColumn;
                        Console.Write(String.Format("{0,-5:##}", intProduct));
                    }
                    Console.WriteLine();
                }
                Console.ReadLine();
    
    

    hello sir thanks for your answer... please tell me what this code is doing
    "{0,-5:##}"
    
    i am not getting this can you please explain
  2. In Topic: Multiplication Tables

    Posted 2 Oct 2012

    Hello sir i have done it, it is working now
    int i,j,sum=0;            
                for (i = 1; i <= 10; i++)
                {
                    for (j = 1; j <= 12; j++)
                    {
                        sum = i * j;
                        if (j == 1)
                        {
                            Console.Write("{0,2}", sum);
                        }
                        else
                        {
                            Console.Write("{0,4}", sum);
                        }                   
                    }
                    Console.WriteLine();
                }
                Console.ReadLine();
            }
    
    
  3. In Topic: Multiplication Tables

    Posted 2 Oct 2012

    View PostCurtis Rutland, on 01 October 2012 - 07:12 AM, said:

    No, you do not need a 2D array for printing things to the console. Read the link that rfs02 posted, then read this page:

    http://blog.stevex.n...ting-in-csharp/

    That's a super-handy reference for most commonly used string formatting needs. What you're looking for is called "padding". You want each column to take the same amount of space, even if the content inside is of a different size.


    Hello sir please help me with this question . I am just a beginner in this field i want to do thing and i read the tutorial i am not able to implement it, please if you can do some favor to me
  4. In Topic: Multiplication Tables

    Posted 1 Oct 2012

    Hello Sir i tried this and it is working can you please check this out

    int i,j,sum=0;            
                for (i = 1; i <= 10; i++)
                {
                    for (j = 1; j <= 10; j++)
                    {
                        sum = i * j;
                        Console.Write(sum+"\t");
                    }
                    Console.WriteLine();
                }
                Console.ReadLine();
    
    
  5. In Topic: Multiplication Tables

    Posted 1 Oct 2012

    View PostNovember-06, on 30 September 2012 - 06:11 PM, said:

    The problem with your code is you are only using WriteLine() causing the next number to be written on the next line (like the behavior of 'Enter' key).

    I revised your code to the following:

                int intProduct = 0;
                for (int intRow = 1; intRow <= 12; intRow++)
                {
                    for (int intColumn = 1; intColumn <= 12; intColumn++)
                    {
                        intProduct = intRow * intColumn;
                        Console.Write(intProduct + "\t");
                    }
                    Console.WriteLine();
                }
    
    


    Sum is for addition, so I changed it to 'Product' since this is a multiplication table. The "\t" is to add tab.

    Hope this helps.

    hello sir i am thankful for your answer but its not working i want to print tables from 1 to 12 column wise.... each table in each different column
    can you have solution for this.
    i think i should use 2d array for this it will work??

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

ankit.mca.aaidu hasn't added any friends yet.

Comments

ankit.mca.aaidu has no profile comments yet. Why not say hello?