78 Answered Questions for the topic C#

Please help me with these questions.

nt[, ] arr = new int[4, 5]; int a = 0; foreach (int i in arr) { Console.Write(i + " "); } Console.WriteLine(" "); for (int i = 0; i < arr.GetLength(0); i++) { for (int j = 0; j... more

Declare and initialize a 3 by 2 array that contains integer values. You decide what the values are.

Declare and initialize a 3 by 2 array that contains integer values. You decide what the values are.  

The array declared as int rooms[4] will not be able to store a value in?

The array declared as int rooms[4] will not be able to store a value in? rooms[0] rooms[1] rooms[2] rooms[3] rooms[4]

What am I doing wrong in my code?

using System; public class Program{ public static void Main() { Console.WriteLine("How many people are in your class? ") classSize = int.Parse(Console.ReadLine()); string students = new... more

Convert the following methods from Java to C and then write a function to test each output with at least 4 test cases to see if the method work correctly.

//Convert an 2D array to a string     String int2DArrayToString(int[][] input)     {         return Arrays.stream(input).map(x -> Arrays.stream(x).                 mapToObj(i ->... more

C# Random Numbers.

create an array of 10 random numbers from 1 to 100. We will use a for loop to populate the array. output the numbers in their original order on one line. We will sort the list and output the... more

What does each line of code does? For example: static private float Median(float[] array) //method heading for the Median method

static private float Median(float[] array)  { float[] tempArray = array; int count = tempArray.Length; Array.Sort(tempArray); float medianValue = 0; if (count % 2 == 0) { float... more

Please help me plug in the median method into my code. I have the method in the public class program. it is static private.but don't know how to print/output. it in the main.

using System;using System.Linq;public class Program{ static private float Median(float[] array) { float[] tempArray = array; int count = tempArray.Length; Array.Sort(tempArray); float... more

C# language - a program that will allow the user to enter the mass in grams andthe radius and height in centimeters of their cylinder, sphere, or cone and calculate the density of their object.

C# ONLY. a program that will allow the user to enter the mass in grams andthe radius and height in centimeters of their cylinder, sphere, or cone and calculate the density of their object. 
C# C++

01/27/21

Write a program to convert kilogram to gram and pound

Declare an array as a global variable, called kilo with 4 elements. - In main(): Call function get_input(). Call function convert_gram(). Call function convert_pound(). - In get_input(): Using... more

Type in textbox C#

Hi!I need help with a programming question. I am not sure how to put it into words but Ill try my best:I want to have a textbox with a text written in it in advance. Let's imagine this is how it... more
C#

12/01/20

C# console application, interfaces

C# console application that simulates athletes using a strategy pattern.
C#

11/26/20

C# - How to test a Truth Table to verify if the row equates to "true" or "false" when ANDed together?

C# - How to test a Truth Table to verify if the row equates to "true" or "false" when ANDed together? //F F F F | F //F F F T | F //F F T F | F //F F T T | F ... more

11/24/20

Rewrite code C#

Hi!I am trying to program my own Pac Man game. I have this code: foreach (Control x in this.Controls) { if (x is PictureBox) { if... more

Using Method in If-statement

Hi!I would like to use an if-statement that will execute a code if a button is clicked, but I can't do the following: if (buttonplus_Click = true) { //code }Is... more

Method code won't work for capitalization

Hi! I am doing a code for method that will capitalize every other word in an input, however my code below does not work and I can not find the reason. Can someone pls help? static string... more

Why wont this code work?

static bool Palindrome (string input)       {           bool pal;           string check = "";           for (int i = input.Length; i >= 0; i--)           {               check = check +... more

C# method returning a bool

Hi!I am checking whether an input is a palindrome or not with the help of a method. However, I get error in the part of code bolded and underlined below:public static bool Check (string input){bool... more

C# Display a pyramid

Hi!I have found this code in the internet: for (int i = 1; i< 10; i++) { for(int j= 1; j<= i; j++) { Console.Write(i); ... more

Programming with C#

Hi, why does it become red in the following code?/* Console.Write("Write a number: ");int number = Convert.ToInt32(Console.ReadLine());if (number % 2 == 0 && (11 < number < 21 || 34... more

08/02/20

URGENT: Problems with API in C# ASP.NET Core

I am doing an ASP.NET Core Website and have to show the list of all countries with their travel advisory scores in a table. I can't display the data using a Travel Advisory API. Each country is a... more

08/02/20

URGENT! Can't show data using API with C# ASP.NET Core

I am using a Travel Advisory API but am unable to show all the data. Each country is a separate key and form different classes when I paste the JSON as classes.How can I call each country class... more

Conditional Statements In C Programmin

Question 11.Given the following code: switch(x - y) { case 0: return x; case 4: break; case 7: x = x - 1; case 9: return x*y; case 3: default: return y - x; ... more

Logical Operators in C programming

1.Question Is the following expression true or false? -1 * -2 == 14 % 4 TrueFalse2.Question 2Is the following conditional statement true or false? int x = 6; -3 < 5 || !(x % 3 == 0) TrueFalse

Printing Problem in C programming

1.Question For the following code: int a = -1; int b = a * 5; printf("a is %d, and b is %d. ", a, b); What is the output?2.Question int x = -1; int y = 3; x= x + Y; printf("x - y is %d. ", x -... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.