. 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 |
How to Create Files by Using the FileInfo Class?
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
Write a program to input an integer and - display the reverse - display the sum of each digit - should include logic that considers the input number as any number of digits long
<ul> <li id="Accommodation" runat="server" visible="false"><a href="../Elements/frmSearchAccommodation.aspx?submenuheader=1">Accommodation</a></li> <li id="Arts" runat="server" visible="false"><a href="../Elements/frmSearchProp.aspx?submenuheader=1">Arts And Props</a></li> <li id="Costume" runat="server" visible="false"><a href="../Elements/frmSearchCostume.aspx?submenuheader=1">Costume</a></li> <li id="Crew" runat="server" visible="false"><a href="../Elements/frmSearchCrew.aspx?submenuheader=1">Crew</a></li> <li id="Catering" runat="server" visible="false"><a href="../Elements/frmSearchCatering.aspx?submenuheader=1">Catering</a></li> <li id="Equipment" runat="server" visible="false"><a href="../Elements/frmSearchEquipment.aspx?submenuheader=1">Equipment</a></li> <li id="Film" runat="server" visible="false"><a href="../Elements/frmSearchFilmTapeStock.aspx?submenuheader=1">Film And Tape Stocks</a></li> <li id="Location" runat="server" visible="false"><a href="../Elements/frmSearchLocation.aspx?submenuheader=1">Location</a></li> <li id="Picture" runat="server" visible="false"><a href="../Elements/frmSearchPictureVehicle.aspx?submenuheader=1">Picture Vehicles</a></li> <li id="Production" runat="server" visible="false"><a href="../Elements/frmSearchProductionSupplies.aspx?submenuheader=1">Production Supplies</a></li> <li id="Post" runat="server" visible="false"><a href="../Elements/frmSearchPostProductionHouse.aspx?submenuheader=1">Post Production Houses</a></li> <li id="Rigging" runat="server" visible="false"><a href="../Elements/frmSearchRigging.aspx?submenuheader=1">Rigging</a></li> <li id="Stunt" runat="server" visible="false"><a href="../Elements/frmSearchStunt.aspx?submenuheader=1">Stunt</a></li> <li id="Studio" runat="server" visible="false"><a href="../Elements/frmSearchStudio.aspx?submenuheader=1">Studio</a></li> <li id="SFX" runat="server" visible="false"><a href="../Elements/frmSearchSFX.aspx?submenuheader=1">SFX</a></li> <li id="Talents" runat="server" visible="false"><a href="../Elements/frmSearchTalent.aspx?submenuheader=1">Talents</a></li> <li id="Transport" runat="server" visible="false"><a href="../Elements/frmSearchTransport.aspx?submenuheader=1">Transport</a></li> <li id="Venue" runat="server" visible="false"><a href="../Elements/frmSearchVenue.aspx?submenuheader=1">Venue</a></li> <li id="Other" runat="server" visible="false"><a href="../PageUnderConstruction.aspx?submenuheader=1">Other</a></li> </ul> I have this code in leftmenu.ascx page..now on leftmenu.ascx.cs page i want to access id values. but i dont want to check manually like Accommodation,Arts etc.. In cs file my code is like string str[]; //this array contains some values say 10 strings for(i=0;i<100;i++) { if(str[i]==id id.visible=true } i.e.i want to travel for each element of str and each value of id.if they match then id.visible=true how to do?
Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number.
Write a program which has a function and that function should take 2 or 3 or any number of strings and it should return the largest common prefix of all those strings. If there is no common prefix it should return an empty string. for eg:- INPUT OUTPUT glo {glory,glorious,glod} gl {glad,glow} {calendar,phone} empty string
Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.
Code for Reading and writing from a file in c#?
how do i copy textbox contents of 1 form to another form
Event Handling in C# Triggering a Button
How to add a value from textBox over an existing certain column in SQL Server
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#