C# Challenges
Buggy Code (Part 1)
Fix the syntax error in the Code tab so the function returns the cube of its argument. Examples Program.Cubes(3) ➞ 27 Program.Cubes(5) ➞ 125 Program.Cubes(10) ➞ 1000 Notes Read the code carefully. This challenge is not supposed to be hard.Boolean to String Conversion
Create a function that takes a boolean flag and returns it as a string. Examples Program.BoolToString(true) ➞ "True" Program.BoolToString(false) ➞ "False" Notes The result must use the exact capitalization shown in the examples.Fix the Expression
Fix the code in the Code tab so the function returns true if and only if x is equal to 7. Examples Program.IsSeven(4) ➞ false Program.IsSeven(9) ➞ false Program.IsSeven(7) ➞ true Notes Look closely at the expression.How Edabit Works
This is an introduction to how challenges on Edabit work. In the code editor below you'll see a starter function that looks like this: public class Program { public static bool ReturnTrue() { } } All you have to do is type return true; between the curly braces { } and then click the Check button. If you did this correctly, a celebration window wReturn the Sum of Two Numbers
Create a function that takes two numbers as arguments and returns their sum. Examples Sum(3, 2) ➞ 5 Sum(-3, -6) ➞ -9 Sum(7, 3) ➞ 10 Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the Solutions tab.Convert Minutes into Seconds
Write a function that takes an integer minutes and converts it to seconds. Examples convert(5) ➞ 300 convert(3) ➞ 180 convert(2) ➞ 120 Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the Solutions tab.Reverse Psychology
Prefix the given action with Do not and finish it with a period. The default action is do anything. Examples Program.ReversePsychology("wash the dishes") ➢ "Do not wash the dishes." Program.ReversePsychology() ➢ "Do not do anything." `Return the Next Number from the Integer Passed
Create a function that takes a number as an argument, increments the number by +1 and returns the result. Examples Addition(0) ➞ 1 Addition(9) ➞ 10 Addition(-3) ➞ -2 Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the Solutions tab.Circuit Power Calculator
Create a function that takes voltage and current and returns the calculated power. Examples CircuitPower(230, 10) ➞ 2300 CircuitPower(110, 3) ➞ 330 CircuitPower(480, 20) ➞ 9600 Notes power is voltage multiplied by currentConvert Age to Days
Create a function that takes the age in years and returns the age in days. Examples CalcAge(65) ➞ 23725 CalcAge(0) ➞ 0 CalcAge(20) ➞ 7300 Notes Use 365 days as the length of a year for this challenge. Ignore leap years and days between last birthday and now. Expect only non-negative integer inputs.Area of a Triangle
Write a function that takes the base and height of a triangle and return its area. Examples triArea(3, 2) ➞ 3 triArea(7, 4) ➞ 14 triArea(10, 10) ➞ 50 Notes The area of a triangle is: (base * height) / 2 Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you're really stuck, unlock solutions in the SolutioReturn the Remainder from Two Numbers
There is a single operator in C#, capable of providing the remainder of a division operation. Two numbers are passed as parameters. The first parameter divided by the second parameter will have a remainder, possibly zero. Return that value. Examples Remainder(1, 3) ➞ 1 Remainder(3, 4) ➞ 3 Remainder(-9, 45) ➞ -9 Remainder(5, 5) ➞ 0 Notes The tests only useMake It a Hashtag
Turn one word into a hashtag. Create MakeHashtag to put "#" before word and return the new string. Keep the word just as it is. Examples Program.MakeHashtag("coding") // "#coding" Program.MakeHashtag("PixelArt") // "#PixelArt" Program.MakeHashtag("X") // "#X" Notes word contains 1 to 20 English letters, with no spaces or existing #. Do not change its capPlayer Two Has Joined
Someone has joined your game! Create JoinMessage to return their username followed by " has joined!". For "Nova", return "Nova has joined!". Examples Program.JoinMessage("Nova") // "Nova has joined!" Program.JoinMessage("Pixel_7") // "Pixel_7 has joined!" Program.JoinMessage("x") // "x has joined!" Notes username contains 1 to 20 English letters, digitsName That Playlist
Give your playlist a name to match its mood. Create PlaylistName to return mood followed by " Mix". For "Late Night", return "Late Night Mix". Examples Program.PlaylistName("Late Night") // "Late Night Mix" Program.PlaylistName("Focus") // "Focus Mix" Program.PlaylistName("Rainy Day") // "Rainy Day Mix" Notes mood is a nonempty string of at most 30 charaRetry or Stop?
Create ShouldRetry to decide whether to try a request again. Return true only when the previous attempt failed and attempts is less than limit. Otherwise, return false. Examples Program.ShouldRetry(true, 2, 3) // true Program.ShouldRetry(false, 2, 3) // false Program.ShouldRetry(true, 3, 3) // false Notes failed is a boolean. attempts is the number of atOne More Encore
The crowd wants one more song! Create EncoreTotal to return the total number of songs after the band adds one encore to songs. Examples Program.EncoreTotal(8) // 9 Program.EncoreTotal(0) // 1 Program.EncoreTotal(20) // 21 Notes songs is a whole number from 0 to 100. The encore always adds exactly one song.Will the Next File Fit?
A drive has capacity megabytes of space, and used megabytes are already taken. Create FileFits to return true if a file of size megabytes will fit. Otherwise, return false. Filling the drive exactly is allowed. Examples Program.FileFits(100, 70, 20) // true Program.FileFits(100, 70, 31) // false Program.FileFits(100, 70, 30) // true Notes All three numbeIs the Number Less than or Equal to Zero?
Create a function that takes a number as its only argument and returns true if it's less than or equal to zero, otherwise return false. Examples LessThanOrEqualToZero(5) ➞ false LessThanOrEqualToZero(0) ➞ true LessThanOrEqualToZero(-2) ➞ true Notes Don't forget to return the result. If you get stuck on a challenge, find help in the Resources tab. If you'reLess Than 100?
Given two numbers, return true if the sum of both numbers is less than 100. Otherwise return false. Examples lessThan100(22, 15) ➞ true // 22 + 15 = 37 lessThan100(83, 34) ➞ false // 83 + 34 = 117 lessThan100(3, 77) ➞ true Notes N/A