. Write a program to print the following outputs using for loops
$ $ $ $ $
$ $ $ $
$ $ $
$ $
$
Answers were Sorted based on User's Feedback
Answer / madhu
namespace Print_
{
class Program
{
static void Main(string[] args)
{
Print pr = new Print();
pr.Print1("6",6);
Console.ReadLine();
}
}
class Print
{
public void Print1(string str, int noPerLine)
{
for (int j = 1; j <= noPerLine; j++)
{
int k = j - 1;
while (k >= 1)
{
Console.Write("$");
k--;
}
Console.WriteLine('\n');
}
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / deepa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i , j, k;
for (j = 0; j < 5; j++)
{
for (k = 0; k < 5; k++)
{
if(k<j)
Console.Write(" ");
else
Console.Write("$");
}
Console.WriteLine("
");
}
}
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / srinivas munagapati
namespace Print_
{
class Program
{
static void Main(string[] args)
{
Print pr = new Print();
pr.Print1("7",7);
Console.ReadLine();
}
}
class Print
{
public void Print1(string str,int noPerLine)
{
for (int j = 1; j <= noPerLine; j++)
{
int k = j - 1;
while (k >= 1)
{
Console.Write("*");
k--;
}
for (int i = j; i <= noPerLine; i++)
{
Console.Write(str);
}
Console.WriteLine('\n');
}
}
}
}
Is This Answer Correct ? | 4 Yes | 7 No |
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#
how can i split sting in textbox in windows application using c# .net
Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number.
program to reverse the order of words in a string.
how do i copy textbox contents of 1 form to another form
Using C# Write a program that performs the following. The user inputs a number and then enters a series of numbers from 1 to that number. Your program should determine which number (or numbers) is missing or duplicated in the series, if any. For example, if the user entered 5 as the initial number and then entered the following sequences, the results should be as shown. Input Sequence Output ---------------------- --------------- 1 2 3 4 5 Nothing bad However, if 7 were the high number, the user would see the results on the right for the following number entries: Input Sequence Output ---------------------- --------------- 1 3 2 4 5 Missing 6 Missing 7 And if 10 were the high number and the user entered the numbers shown on the left, note the list of missing and duplicate numbers: Input Sequence Output ---------------------- --------------- 1 2 4 7 4 4 5 10 8 2 6 Duplicate 2 ( 2 times) Missing 3 Duplicate 4 ( 3 times ) Missing 9 The program should check the high number that the user inputs to ensure that it does not exceed the size of any array you might be using for storage.
Code for Working with Files under a Directory?
program to check if a number is "perfect number".
program for addition of fraction(M/N + P/Q = Y/Z)
How to Create a Treeview Menu in ASP.NET with C#?
how to get the table names via c sharp and column names also?
How to pass multiple rows from one gridview to another gridview after clicking the checkbox.