A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C# program to that takes a number as input and display it four times in a row (separated by blank spaces), and then four times in the next row, with no separation. You should do it two times: Use Console. Write and then use {0}
Q:

Write a C# program to that takes a number as input and display it four times in a row (separated by blank spaces), and then four times in the next row, with no separation. You should do it two times: Use Console. Write and then use {0}

0

Write a C# program to that takes a number as input and display it four times in a row (separated by blank spaces), and then four times in the next row, with no separation. You should do it two times: Use Console. Write and then use {0}

Sample Output:

Enter a digit:                                                                                                
2                                                                                                             
2 2 2 2                                                                                                       
2222                                                                                             
2 2 2 2                                                                                                       
2222

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
public class Exercise12
{
    public static void Main()
    {
        int num; 
  
        Console.WriteLine("Enter a digit: ");
        num = Convert.ToInt32( Console.ReadLine() );
  
        // Part A: "num num num num" using Write
        Console.Write( num );
        Console.Write(" ");
        Console.Write( num );
        Console.Write(" ");
        Console.Write( num );
        Console.Write(" ");
        Console.Write( num );
        Console.WriteLine();
  
        // Part B: "numnumnumnum" using Write
        Console.Write( num );
        Console.Write( num );
        Console.Write( num );
        Console.WriteLine( num );
        Console.WriteLine();
  
        // Part C: "num num num num" using {0}
        Console.WriteLine("{0} {0} {0} {0}", num);
  
        // Part D: "numnumnumnum" using {0}
        Console.WriteLine("{0}{0}{0}{0}", num);
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now