. 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 |
program for addition of fraction(M/N + P/Q = Y/Z)
Can you declare an array of mixed Types?
how to change password in .net with c # with ado.net and also SQL server 2008 change password
Code for Reading and writing from a file?
How to Create Files by Using the FileInfo Class?
Write a function which accepts a sentence as input parameter.Each word in that sentence is to be reversed. Space should be there between each words.Return the sentence with reversed words to main function and produce the required output. for eg:- i/p: jack jill jung kill o/p: kcaj llij gnuj llik
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#
Code for Working with Files under a Directory?
Code for IP Address Comparison and Conversion in C#?
How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)
Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.
how to get the table names via c sharp and column names also?