Skip to content

kebbell/C-QUESTIONAIRE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C# Sharp Basic Exercises [104 exercises with solution]

  1. Write a C# Sharp program to print Hello and your name in a separate line. Expected Output : Hello: Alexandra Abramov

  2. Write a C# Sharp program to print the sum of two numbers. Click me to see the solution

  3. Write a C# Sharp program to print the result of dividing two numbers. Click me to see the solution

  4. Write a C# Sharp program to print the results of the specified operations. Test data:

-1 + 4 * 6 ( 35+ 5 ) % 7 14 + -4 * 6 / 11 2 + 15 / 6 * 1 - 7 % 2 Expected Output: 23 5 12 3 Click me to see the solution

  1. Write a C# Sharp program to swap two numbers. Test Data: Input the First Number : 5 Input the Second Number : 6 Expected Output: After Swapping : First Number : 6 Second Number : 5 Click me to see the solution

  2. Write a C# Sharp program to print the output of the multiplication of three numbers entered by the user. Test Data: Input the first number to multiply: 2 Input the second number to multiply: 3 Input the third number to multiply: 6 Expected Output: 2 x 3 x 6 = 36 Click me to see the solution

  3. Write a C# Sharp program to print on screen the output of adding, subtracting, multiplying and dividing two numbers entered by the user. Test Data: Input the first number: 25 Input the second number: 4 Expected Output: 25 + 4 = 29 25 - 4 = 21 25 x 4 = 100 25 / 4 = 6 25 mod 4 = 1 Click me to see the solution

  4. Write a C# Sharp program that prints the multiplication table of a number as input. Test Data: Enter the number: 5 Expected Output: 5 * 0 = 0 5 * 1 = 5 5 * 2 = 10 5 * 3 = 15 .... 5 * 10 = 50 Click me to see the solution

  5. Write a C# Sharp program that takes four numbers as input to calculate and print the average. Test Data: Enter the First number: 10 Enter the Second number: 15 Enter the third number: 20 Enter the four number: 30

Expected Output: The average of 10 , 15 , 20 , 30 is: 18 Click me to see the solution

  1. Write a C# Sharp program that takes three numbers (x,y,z) as input and outputs (x+y).z and x.y + y.z. Test Data: Enter first number - 5 Enter second number - 6 Enter third number - 7

Expected Output: Result of specified numbers 5, 6 and 7, (x+y).z is 77 and x.y + y.z is 72 Click me to see the solution

  1. Write a C# Sharp program that takes an age (for example 20) as input and prints something like "You look older than 20". Test Data: Enter your age - 25 Expected Output: You look older than 25 Click me to see the solution

  2. Write a C# program that takes a number as input and displays it four times in a row (separated by blank spaces), and then four times in the next row, with no separation. You should do it twice: Use the console. Write and use {0}. Test Data: Enter a digit: 25 Expected Output: 25 25 25 25 25252525 25 25 25 25 25252525 Click me to see the solution

  3. Write a C# program that takes a number as input and displays a rectangle of 3 columns wide and 5 rows tall using that digit. Test Data: Enter a number: 5 Expected Output: 555 5 5 5 5 5 5 555 Click me to see the solution

  4. Write a C# program to convert Celsius degrees to Kelvin and Fahrenheit. Test Data: Enter the amount of celsius: 30 Expected Output: Kelvin = 303 Fahrenheit = 86 Click me to see the solution

  5. Write a C# program that removes a specified character from a non-empty string using the index of a character. Test Data: w3resource Sample Output: wresource w3resourc 3resource Click me to see the solution

  6. Write a C# program to create a new string from a given string where the first and last characters change their positions. Test Data: w3resource Python Sample Output: e3resourcw nythoP x Click me to see the solution

  7. Write a C# program to create a string from a given string (length 1 or more) with the first character added at the front and back. Sample Output: Input a string : The quick brown fox jumps over the lazy dog. TThe quick brown fox jumps over the lazy dog.T Click me to see the solution

  8. Write a C# program to check a pair of integers and return true if one is negative and one is positive. Sample Output: Input first integer: -5 Input second integer: 25 Check if one is negative and one is positive: True Click me to see the solution

  9. Write a C# program to compute the sum of two given integers. If two values are the same, return the triple of their sum. Click me to see the solution

  10. Write a C# program to get the absolute value of the difference between two given numbers. Return double the absolute value of the difference if the first number is greater than the second number. Click me to see the solution

  11. Write a C# program to check the sum of the two given integers. Return true if one of the integers is 20 or if their sum is 20. Click me to see the solution

  12. Write a C# program to check if the given integer is within 20 of 100 or 200. Sample Output: Input an integer: 25 False Click me to see the solution

  13. Write a C# program to convert a given string into lowercase. Sample Output: write a c# sharp program to display the following pattern using the alphabet. Click me to see the solution

  14. Write a C# program to find the longest word in a string. Test Data: Write a C# Sharp Program to display the following pattern using the alphabet. Sample Output: following Click me to see the solution

  15. Write a C# program to print odd numbers from 1 to 99. Prints one number per line. Sample Output: Odd numbers from 1 to 99. Prints one number per line. 1 3 5 7 9 ... 95 97 99 Click me to see the solution

  16. Write a C# program to compute the sum of the first 500 prime numbers. Sample Output: Sum of the first 500 prime numbers: 824693 Click me to see the solution

  17. Write a C# program and compute the sum of an integer's digits. Sample Output: Input a number(integer): 12 Sum of the digits of the said integer: 3 Click me to see the solution

  18. Write a C# program to reverse the words of a sentence. Sample Output: Original String: Display the pattern like pyramid using the alphabet. Reverse String: alphabet. the using pyramid like pattern the Display Click me to see the solution

  19. Write a C# program to find the size of a specified file in bytes. Sample Output: Size of a file: 31 Click me to see the solution

  20. Write a C# program to convert a hexadecimal number to a decimal number. Sample Output: Hexadecimal number: 4B0 Convert to- Decimal number: 1200 Click me to see the solution

  21. Write a C# program to multiply the corresponding elements of two integer arrays. Sample Output: Array1: [1, 3, -5, 4] Array2: [1, 4, -5, -2] Multiply corresponding elements of two arrays: 1 12 25 -8 Click me to see the solution

  22. Write a C# program to create a string of four copies, taking the last four characters from a given string. If the given string is less than 4, return the original one. Sample Output: Input a string : The quick brown fox jumps over the lazy dog. dog.dog.dog.dog. Click me to see the solution

  23. Write a C# program to check if a given positive number is a multiple of 3 or 7. Sample Output: Input first integer: 15 True Click me to see the solution

  24. Write a C# program to check if a string starts with a specified word. Note: Suppose the sentence starts with "Hello" Sample Data: string1 = "Hello how are you?" Result: Hello. Sample Output: Input a string : Hello how are you? True Click me to see the solution

  25. Write a C# program to check two given numbers where one is less than 100 and the other is greater than 200. Sample Output: Input a first number(<100): 75 Input a second number(>100): 250 True Click me to see the solution

  26. Write a C# program to check if an integer (from the two given integers) is in the range -10 to 10. Sample Output: Input a first number: -5 Input a second number: 8 True Click me to see the solution

  27. Write a C# program to check if "HP" appears at the second position in a string and return the string without "HP". Test Data: PHP Tutorial Sample Output: P Tutorial Click me to see the solution

  28. Write a C# program to get a string of two characters from a given string. The first and second characters of the given string must be "P" and "H", so PHP will be "PH". Test Data: PHP Sample Output: PH Click me to see the solution

  29. Write a C# program to find the largest and lowest values from three integer values. Test Data: Input first integer: 15 Input second integer: 25 Input third integer: 30 Sample Output Largest of three: 30 Lowest of three: 15 Click me to see the solution

  30. Write a C# program that checks the nearest value of 20 of two given integers and return 0 if two numbers are same. Test Data: Input first integer: 15 Input second integer: 12 Sample Output 15 Click me to see the solution

  31. Write a C# program to check if a given string contains the 'w' character between 1 and 3 times. Test Data: Input a string (contains at least one 'w' char) : w3resource Test the string contains 'w' character between 1 and 3 times: Sample Output True Click me to see the solution

  32. Write a C# program to create a string where the first 4 characters are in lower case. If the string is less than 4 letters, make the whole string in upper case. Test Data: Input a string: w3r Sample Output W3R Click me to see the solution

  33. Write a C# program to check if a given string starts with "w" and is immediately followed by two "ww". Test Data: Input a string : www Sample Output False Click me to see the solution

  34. Write a C# program to create a string of every other character (odd position) from the first position of a given string. Test Data: Input a string : w3resource Sample Output wrsuc Click me to see the solution

  35. Write a C# program to count a specified number in a given array of integers. Test Data: Input an integer: 5 Sample Output Number of 5 present in the said array: 2 Click me to see the solution

  36. Write a C# program to check if a number appears as the first or last element of an array of integers. The array length is 1 or more. Test Data: Input an integer: 25 Sample Output False Click me to see the solution

  37. Write a C# program to compute the sum of all the elements of an array of integers. Test Data: Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] Sample Output Sum: 69 Click me to see the solution

  38. Write a C# program that checks if the first element and the last element of an array of integers are equal. The array length is 1 or more. Test Data: Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] Sample Output True Click me to see the solution

  39. Write a C# program to check if the first or the last element of the two arrays (length 1 or more) are equal. Test Data: Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] Array2: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 5] Check if the first element or the last element of the two arrays ( leng th 1 or more) are equal. Sample Output True Click me to see the solution

  40. Write a C# program to rotate an array (length 3) of integers in the left direction. Test Data: Array1: [1, 2, 8] After rotating array becomes: [2, 8, 1] Click me to see the solution

  41. Write a C# program to get the largest value between the first and last element of an array (length 3) of integers. Test Data: Array1: [1, 2, 5, 7, 8] Highest value between first and last values of the said array: 8 Click me to see the solution

  42. Write a C# program to create a new array of length containing the middle elements of three arrays (each length 3) of integers. Test Data: Array1: [1, 2, 5] Array2: [0, 3, 8] Array3: [-1, 0, 2] New array: [2, 3, 0] Click me to see the solution

  43. Write a C# program to check if an array contains an odd number. Test Data: Original array: [2, 4, 7, 8, 6] Check if an array contains an odd number? True Click me to see the solution

  44. Write a C# program to get the century of a year. Click me to see the solution

  45. Write a C# program to find the pair of adjacent elements that has the largest product of the given array. Click me to see the solution

  46. Write a C# program to check if a given string is a palindrome or not. Sample Example: For 'aaa' the output should be true For 'abcd' the output should be false Click me to see the solution

  47. Write a C# program to find the pair of adjacent elements that has the highest product of an array of integers. Click me to see the solution

  48. Write a C# program that accepts a list of integers and checks how many integers are needed to complete the range. Sample Example [1, 3, 4, 7, 9], between 1-9 -> 2, 5, 6, 8 are not present in the list. So output will be 4. Click me to see the solution

  49. Write a C# program to check whether it is possible to create a strictly increasing sequence from a given sequence of integers as an array. Click me to see the solution

  50. Write a C# program to calculate the sum of all integers in a rectangular matrix. However, exclude those integers located below an integer of value 0. Sample Example: matrix = [[0, 2, 3, 2], [0, 6, 0, 1], [4, 0, 3, 0]] Eligible integers which will be participated to calculate the sum - matrix = [[X, 2, 3, 2], [X, 6, X, 1], [X, X, X, X]] Therefore sum will be: 2 + 3 + 2 + 6 + 1 = 14 Click me to see the solution

  51. Write a C# program to sort the integers in ascending order without moving the number -5. Click me to see the solution

  52. Write a C# program to reverse the strings contained in each pair of matching parentheses in a given string. It should also remove the parentheses from the given string. Click me to see the solution

  53. Write a C# program to check if a given number is present in an array of numbers. Click me to see the solution

  54. Write a C# Sharp program to get the file name (including extension) from a given path. Click me to see the solution

  55. Write a C# Sharp program to multiply all elements of a given array of numbers by array length. Click me to see the solution

  56. Write a C# Sharp program to find the minimum value from two numbers given to you, represented as a string. Click me to see the solution

  57. Write a C# Sharp program to create a coded string from a given string, using a specified formula. Replace all 'P' with '9', 'T' with '0', 'S' with '1', 'H' with '6' and 'A' with '8'. Sample Output: 969 J8V81CRI90 Click me to see the solution

  58. Write a C# Sharp program to count a specified character (both cases) in a given string. Click me to see the solution

  59. Write a C# Sharp program to check if a given string contains only lowercase or uppercase characters. Click me to see the solution

  60. Write a C# Sharp program to remove the first and last elements from a given string. Sample Output: Original string: PHP After removing first and last elements: H Original string: Python After removing first and last elements: ytho Original string: JavaScript After removing first and last elements: avaScrip Click me to see the solution

  61. Write a C# Sharp program to check if a given string contains two similar consecutive letters. Sample Output: Original string: PHP Test for consecutive similar letters! False Original string: PHHP Test for consecutive similar letters! True Original string: PHPP Test for consecutive similar letters! True Original string: PPHP Test for consecutive similar letters! True Click me to see the solution

  62. Write a C# Sharp program to check whether the average value of the elements of a given array of numbers is a whole number or not. Sample Output: nums = { 1, 2, 3, 5, 4, 2, 3, 4 } Check the average value of the said array is a whole number or not: True nums1 = { 2, 4, 2, 6, 4, 8 } Check the average value of the said array is a whole number or not: False Click me to see the solution

  63. Write a C# Sharp program to convert the letters of a given string (same case-upper/lower) into alphabetical order. Sample Output: Original string: PHP Convert the letters of the said string into alphabetical order: HPP Original string: javascript Convert the letters of the said string into alphabetical order: aacijprstv Original string: python Convert the letters of the said string into alphabetical order: hnopty Click me to see the solution

  64. Write a C# Sharp program to check the length of a given string is odd or even. Return 'Odd length' if the string length is odd otherwise 'Even length'. Sample Output: Original string: PHP Convert the letters of the said string into alphabetical order: Odd length Original string: javascript Convert the letters of the said string into alphabetical order: Even length Original string: python Convert the letters of the said string into alphabetical order: Even length Click me to see the solution

  65. Write a C# Sharp program that takes a positive number and returns the nth odd number. Sample Output: 1st odd number: 1 2nd odd number: 3 4th odd number: 7 100th odd number: 199 Click me to see the solution

  66. Write a C# Sharp program to get the ASCII value of a given character. Sample Output: Ascii value of 1 is: 49 Ascii value of A is: 65 Ascii value of a is: 97 Ascii value of # is: 35 Click me to see the solution

  67. Write a C# Sharp program to check whether a word is plural or not. Sample Output: Is 'Exercise' is plural? False Is 'Exercises' is plural? True Is 'Books' is plural? True Is 'Book' is plural? False Click me to see the solution

  68. Write a C# Sharp program to find the sum of squares of elements in a given array of integers. Sample Output: Sum of squares of elements of the said array: 14 Sum of squares of elements of the said array: 29 Click me to see the solution

  69. Write a C# Sharp program to convert an integer to a string and a string to an integer. Sample Output: Original value and type: 50, System.String Convert string to integer: Return value and type: 50, System.Int32 Original value and type: 122, System.Int32 Convert integer to string: Return value and type: 122, System.String Click me to see the solution

  70. Write a C# Sharp program to convert all the values of a given array of mixed values to string values. Sample Output: Printing original array elements and their types: Value-> 25 :: Type-> System.Int32 Value-> Anna :: Type-> System.String Value-> False :: Type-> System.Boolean Value-> 4/15/2021 10:37:47 AM :: Type-> System.DateTime Value-> 112.22 :: Type-> System.Double Printing array elements and their types: Value-> 25 :: Type-> System.String Value-> Anna :: Type-> System.String Value-> False :: Type-> System.String Value-> 4/15/2021 10:37:47 AM :: Type-> System.String Value-> 112.22 :: Type-> System.String Click me to see the solution

  71. Write a C# Sharp program to swap a two-digit number and check whether the given number is greater than its swap value. Sample Output: Input an integer value: Check whether the said value is greater than its swap value: True Click me to see the solution

  72. Write a C# Sharp program to remove all non-letter characters from a given string. From Wikipedia, A letter is a segmental symbol of a phonemic writing system. The inventory of all letters forms the alphabet. Letters broadly correspond to phonemes in the spoken form of the language, although there is rarely a consistent, exact correspondence between letters and phonemes Sample Output: Orginal string: Py@th12on Remove all characters from the said string which are non-letters: Python Orginal string: Python 3.0 Remove all characters from the said string which are non-letters: Python Orginal string: 2^sdfds*^*^jlljdslfnoswje34u230sdfds984 Remove all characters from the said string which are non-letters: sdfdsjlljdslfnoswjeusdfds Click me to see the solution

  73. Write a C# Sharp program to remove all vowels from a given string. Sample Output: Orginal string: Python After removing all the vowels from the said string: Pythn Orginal string: C Sharp After removing all the vowels from the said string: C Shrp Orginal string: JavaScript After removing all the vowels from the said string: JvScrpt Click me to see the solution

  74. Write a C# Sharp program to get the index number of all lower case letters in a given string. Sample Output: Orginal string: Python Indices of all lower case letters of the said string: 1 2 3 4 5 Orginal string: JavaScript Indices of all lower case letters of the said string: 1 2 3 5 6 7 8 9 Click me to see the solution

  75. Write a C# Sharp program to find the cumulative sum of an array of numbers. A cumulative sum is a sequence of partial sums of a given sequence. For example, the cumulative sums of the sequence {x, y, z,...}, are x , x+y , x+y+z Sample Output: Orginal Array elements: 1 3 4 5 6 7 Cumulative sum of the said array elements: 1 4 8 13 19 26 Orginal Array elements: 1.2 -3 4.1 6 -5.47 Cumulative sum of the said array elements: 1.2 -1.8 2.3 8.3 2.83 Click me to see the solution

  76. Write a C# Sharp program to get the number of letters and digits in a given string. Sample Output: Original string:: Python 3.0 Number of letters: 6 Number of digits: 2 Original string:: dsfkaso230samdm2423sa Number of letters: 14 Number of digits: 7 Click me to see the solution

  77. Write a C# Sharp program to reverse a Boolean value. Sample Output: Original value: False Reverse value: True Original value: True Reverse value: False Click me to see the solution

  78. Write a C# Sharp program to find the sum of the interior angles (in degrees) of a given polygon. Input the number of straight lines. From Wikipedia, In geometry, a polygon is a plane figure that is described by a finite number of straight line segments connected to form a closed polygonal chain or polygonal circuit. The solid plane region, the bounding circuit, or the two together, may be called a Polygon. Sample Output: Input number of straight lines of the polygon: Sum of the interior angles (in degrees) of the said polygon: -360 Click me to see the solution

  79. Write a C# Sharp program to count positive and negative numbers in a given array of integers. Sample Output: Original Array elements: 10 -11 12 -13 14 -18 19 -20 Number of positive numbers: 4 Number of negative numbers: 4 Original Array elements: -4 -3 -2 0 3 5 6 2 6 Number of positive numbers: 5 Number of negative numbers: 3 Original Array elements: Number of positive numbers: 0 Number of negative numbers: 0 Click me to see the solution

  80. Write a C# Sharp program to count the number of ones and zeros in the binary representation of a given integer. Sample Output: Original number: 12 Number of ones and zeros in the binary representation of the said number: Number of ones: 2 Number of zeros: 2 Original number: 1234 Number of ones and zeros in the binary representation of the said number: Number of ones: 5 Number of zeros: 6 Click me to see the solution

  81. Write a C# Sharp program to remove all values except integer values from a given array of mixed values. Sample Output: Original array elements: 25 Anna False 4/24/2021 11:43:11 AM -112 -34.67 After removing all the values except integer values from the said array of mixed values: 25 -112 Click me to see the solution

  82. Write a C# Sharp program to find the next prime number of a given number. If the given number is a prime number, return the number. From Wikipedia, A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself. However, 4 is composite because it is a product (2 × 2) in which both numbers are smaller than 4. Primes are central in number theory because of the fundamental theorem of arithmetic: every natural number greater than 1 is either a prime itself or can be factorized as a product of primes that is unique up to their order. Sample Output: Original number: 120 Next prime number/Current prime number: 127 Original number: 321 Next prime number/Current prime number: 331 Original number: 43 Next prime number/Current prime number: 43 Original number: 4433 Next prime number/Current prime number: 4441 Click me to see the solution

  83. Write a C# Sharp program to calculate the square root of a given number. Return the integer part of the result instead of using any built-in functions. Sample Data: (120) -> 10 (225) -> 15 (335) -> 18 Click me to see the solution

  84. Write a C# program that finds the longest common prefix from an array of strings. Sample Data: ({ "Padas", "Packed", "Pace", "Pacha" }) -> "Pa" ({ "Jacket", "Joint", "Junky", "Jet" }) -> "J" ({ "Bort", "Whang", "Yarder", "Zoonic" }) -> "" Click me to see the solution

  85. Write a C# programme to check the said string is valid or not. The input string will be valid when open brackets and closed brackets are same type of brackets. Or open brackets will be closed in proper order. Sample Data: ( "<>") -> True ("<>()[]{}”) -> True ("(<>”) -> False ("[<>()[]{}]”) -> True Click me to see the solution

  86. Write a C# Sharp program to check whether all characters in a string are the same. Return true if all the characters in the string are the same, otherwise false. Sample Data: ("aaa") -> True ("abcd") -> False ("3333") -> True ("2342342") -> False Click me to see the solution

  87. Write a C# Sharp program to check if a given string (floating point and negative numbers included) is numeric or not. Return True if the string is numeric, otherwise false. Sample Data: ("123") -> True ("123.33") -> True ("33/33") -> False ("234234d2") -> False Click me to see the solution

  88. Write a C# Sharp program to create and display all prime numbers in strictly descending decimal digit order. Sample Data: 2, 3, 5, 7, 31, 41, 43, 53, 61, 71, 73, 83, 97, 421, 431..... Click me to see the solution

  89. Write a C# Sharp program to create and display all prime numbers in strict ascending decimal digit order. Sample Data: 2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, Click me to see the solution

  90. Write a C# Sharp program to check the equality comparison (value and type) of two parameters. Return true if they are equal otherwise false. Sample Data: ("AAA", "BBB") -> False (true, false) -> False (true, "true") -> False (10, 10) -> True Click me to see the solution

  91. Write a C# Sharp program to calculate the value of e. Note: e is also known as Euler's number and Napier's constant Sample Data: e = 2.718281828459050 Click me to see the solution

  92. Write a C# Sharp program to create an identity matrix. Sample Data: Input a number: 3 1 0 0 0 1 0 0 0 1 Click me to see the solution

  93. Write a C# Sharp program to sort characters in a given string (uppercase/lowercase letters and numbers). Return the newly sorted string. Sample Data: ("AAAbfed231") -> "AAAbdef123" (" ") -> "Blank string!" ("Python") -> "hnoPty" ("W3resource") -> "ceeorrsuW3" Click me to see the solution

  94. Write a C# Sharp program to compare the equality of three integers and calculate how many integers have the same value. Sample Data: (1,2, 3) -> 0 (1,3,3) -> 2 (3,3,3) -> 3 Click me to see the solution

/////////////////////////////////////////////////////

C# Sharp Basic Algorithm Exercises

  1. Write a C# Sharp program to compute the sum of the two numerical values. If the two values are the same, return triple their sum.

Sample Input: 1, 2 3, 2 2, 2 Expected Output:

3 5 12
Click me to see the solution 2. Write a C# Sharp program to get the absolute difference between n and 51. If n is broader than 51 return triple the absolute difference.

Sample Input: 53 30 51 Expected Output:

6 21 0 Click me to see the solution 3. Write a C# Sharp program to check two given integers, and return true if one of them is 30 or if their sum is 30.

Sample Input: 30, 0 25, 5 20, 30 20, 25 Expected Output:

True True True False Click me to see the solution 4. Write a C# Sharp program to check a given integer and return true if it is within 10 of 100 or 200.

Sample Input: 103 90 89

Expected Output:

True True False Click me to see the solution 5. Write a C# Sharp program to create a string where 'if' is added to the front of a given string. If the string already begins with 'if', return it unchanged.

Sample Input: "if else" "else" Expected Output:

if else if else Click me to see the solution 6. Write a C# Sharp program to remove the character at a given position in the string. The given position will be in the range 0..(string length -1) inclusive.

Sample Input: "Python", 1 "Python", o "Python", 4 Expected Output:

Pthon ython Pythn Click me to see the solution 7. Write a C# Sharp program to exchange the first and last characters in a given string and return the new string.

Sample Input: "abcd" "a" "xy" Expected Output:

dbca a yx Click me to see the solution 8. Write a C# Sharp program to create a string which is 4 copies of the 2 front characters of a given string. If the given string length is less than 2 return the original string.

Sample Input: "C Sharp" "JS" "a" Expected Output:

C C C C JSJSJSJS a Click me to see the solution 9. Write a C# Sharp program to create a string with the last char added at the front and back of a given string of length 1 or more.

Sample Input: "Red" "Green" "1" Expected Output:

dRedd nGreenn 111 Click me to see the solution 10. Write a C# Sharp program to check if a given positive number is a multiple of 3 or 7.

Sample Input: 3 14 12 37 Expected Output:

True True True False Click me to see the solution 11. Write a C# Sharp program to create a string taking the first 3 characters of a given string. Return the string with the 3 characters added at both the front and back. If the given string length is less than 3, use whatever characters are there.

Sample Input: "Python" "JS" "Code" Expected Output:

PytPythonPyt JSJSJS CodCodeCod Click me to see the solution 12. Write a C# Sharp program to check if a given string starts with 'C#' or not.

Sample Input: "C# Sharp" "C#" "C++" Expected Output:

True True False Click me to see the solution 13. Write a C# Sharp program that checks whether one temperature is less than 0 and another is greater than 100.

Sample Input: 120, -1 -1, 120 2, 120 Expected Output:

True True False Click me to see the solution 14. Write a C# Sharp program to check two given integers whether either of them is in the range 100..200 inclusive.

Sample Input: 100, 199 250, 300 105, 190 Expected Output:

True False True Click me to see the solution 15. Write a C# Sharp program to check whether three given integer values are in the range 20..50 inclusive. Return true if 1 or more of them are in the said range otherwise false.

Sample Input: 11, 20, 12 30, 30, 17 25, 35, 50 15, 12, 8 Expected Output:

True True True False Click me to see the solution 16. Write a C# Sharp program to check whether two given integer values are in the range 20..50 inclusive. Return true if one or other is in the range, otherwise false.

Sample Input: 20, 84 14, 50 11, 55 25, 40 Expected Output:

True True False True Click me to see the solution 17. Write a C# Sharp program to check if a string 'yt' appears at index 1 in a given string. If it appears return a string without 'yt' otherwise return the original string.

Sample Input: "Python" "ytade" "jsues" Expected Output:

Phon ytade jsues Click me to see the solution 18. Write a C# Sharp program to check the largest number among three given integers.

Sample Input: 1,2,3 1,3,2 1,1,1 1,2,2 Expected Output:

3 3 1 2 Click me to see the solution 19. Write a C# Sharp program to check which number is closest to 100 among two given integers. Return 0 if the two numbers are equal.

Sample Input: 78, 95 95, 95 99, 70 Expected Output:

95 0 99 Click me to see the solution 20. Write a C# Sharp program to check whether two given integers are in the range 40..50 inclusive, or they are both in the range 50..60 inclusive.

Sample Input: 78, 95 25, 35 40, 50 55, 60 Expected Output:

False False True True Click me to see the solution 21. Write a C# Sharp program to find the largest value from two positive integer values in the range 20..30 inclusive. Return 0 if neither is in that range.

Sample Input: 78, 95 20, 30 21, 25 28, 28 Expected Output:

0 30 25 28 Click me to see the solution 22. Write a C# Sharp program to check if a given string contains between 2 and 4 'z' characters.

Sample Input: "frizz" "zane" "Zazz" "false" "zzzz" "ZZZZ" Expected Output:

True False True False True False Click me to see the solution 23. Write a C# Sharp program to check if two given non-negative integers have the same last digit.

Sample Input: 123, 456 12, 512 7, 87 12, 45 Expected Output:

False True True False Click me to see the solution 24. Write a C# Sharp program to convert the last 3 characters of a given string to uppercase. If the length of the string is less than 3, then uppercase all the characters.

Sample Input: "Python" "Javascript" "js" "PHP" Expected Output:

PytHON JavascrIPT JS PHP Click me to see the solution 25. Write a C# Sharp program to create a string which is n (non-negative integer) copies of a given string.

Sample Input: "JS", 2 "JS", 3 "JS", 1 Expected Output:

JSJS JSJSJS JS Click me to see the solution 26. Write a C# Sharp program to create a string that is n (non-negative integer) copies of the first 3 characters of a given string. If the given string is shorter than 3, return n copies of the string.

Sample Input: "Python", 2 "Python", 3 "JS", 3 Expected Output:

PytPyt PytPytPyt JSJSJS Click me to see the solution 27. Write a C# Sharp program to count the string "aa" in a given string and assume "aaa" contains two "aa".

Sample Input: "bbaaccaag" "jjkiaaasew" "JSaaakoiaa" Expected Output:

2 2 3 Click me to see the solution 28. Write a C# Sharp program to check if the first appearance of "a" in a given string is immediately followed by another "a".

Sample Input: "caabb" "babaaba" "aaaaa" Expected Output:

True False True Click me to see the solution 29. Write a C# Sharp program to create a string made of every other character starting with the first in a given string.

Sample Input: "Python" "PHP" "JS" Expected Output:

Pto PP J Click me to see the solution 30. Write a C# Sharp program to create a string like "aababcabcd" from a given string "abcd".

Sample Input: "abcd" "abc" "a" Expected Output:

aababcabcd aababc a Click me to see the solution 31. Write a C# Sharp program to count a substring of length 2 that appears in a given string. This substring appears as the last 2 characters of the string. Do not count the end substring.

Sample Input: "abcdsab" "abcdabab" "abcabdabab" "abcabd" Expected Output:

1 2 3 0 Click me to see the solution 32. Write a C# Sharp program to check if a specified number is present in a given array of integers.

Sample Input: {1,2,9,3}, 3 {1,2,2,3}, 2 {1,2,2,3}, 9 Expected Output:

True True False Click me to see the solution 33. Write a C# Sharp program to check if one of the first 4 elements in an array of integers is equal to a given element.

Sample Input: {1,2,9,3}, 3 {1,2,3,4,5,6}, 2 {1,2,2,3}, 9 Expected Output:

True True False Click me to see the solution 34. Write a C# Sharp program to check whether the sequence of numbers 1, 2, 3 appears in a given array of integers somewhere.

Sample Input: {1,1,2,3,1} {1,1,2,4,1} {1,1,2,1,2,3} Expected Output:

True False True Click me to see the solution 35. Write a C# Sharp program to compare two given strings and return the number of positions where they contain the same length of 2 substrings.

Sample Input: "abcdefgh", "abijsklm" "abcde", "osuefrcd" "pqrstuvwx", "pqkdiewx" Expected Output:

1 1 2 Click me to see the solution 36. Write a C# Sharp program to create a string from a given string where a specified character is removed except for the beginning and ending positions.

Sample Input: "xxHxix", "x" "abxdddca", "a" "xabjbhtrb", "b" Expected Output:

xHix abxdddca xajhtrb Click me to see the solution 37. Write a C# Sharp program to create a string of characters at indexes 0,1, 4,5, 8,9 ... from a given string.

Sample Input: "Python" "JavaScript" "HTML" Expected Output:

Pyon JaScpt HT Click me to see the solution 38. Write a C# Sharp program to count the number of two 5's next to each other in an array of integers. Count the situation where the second 5 is actually a 6.

Sample Input: { 5, 5, 2 } { 5, 5, 2, 5, 5 } { 5, 6, 2, 9} Expected Output:

1 2 1 Click me to see the solution 39. Write a C# Sharp program to check if a triple is present in an array of integers or not. If a value appears three times in a row in an array it is called a triple.

Sample Input: { 1, 1, 2, 2, 1 } { 1, 1, 2, 1, 2, 3 } { 1, 1, 1, 2, 2, 2, 1 } Expected Output:

False False True Click me to see the solution 40. Write a C# Sharp program to compute the sum of the two given integers. If the sum is in the range 10..20 inclusive return 30.

Sample Input: 12, 17 2, 17 22, 17 20, 0 Expected Output:

29 30 39 30 Click me to see the solution 41. Write a C# Sharp program that accepts two integers and returns true if either is 5 or their sum or difference is 5.

Sample Input: 5, 4 4, 3 1, 4 Expected Output:

True False True Click me to see the solution 42. Write a C# Sharp program to test if a given non-negative number is a multiple of 13 or one more than a multiple of 13.

Sample Input: 13 14 27 41 Expected Output:

True True True False Click me to see the solution 43. Write a C# Sharp program to check if a given number that is not negative is a multiple of 3 or 7, but not both.

Sample Input: 3 7 21 Expected Output:

True True False Click me to see the solution 44. Write a C# Sharp program to check if a given number is within 2 of a multiple of 10.

Sample Input: 3 7 8 21 Expected Output:

False False True True Click me to see the solution 45. Write a C# Sharp program to compute the sum of the two given integers. Return 18 if one of the given integer values is in the range of 10..20 inclusive.

Sample Input: 3, 7 10, 11 10, 20 21, 220 Expected Output:

10 18 18 241 Click me to see the solution 46. Write a C# Sharp program to check whether a given string begins with "F" or ends with "B". If the string starts with "F" return "Fizz" and return "Buzz" if it ends with "B" If the string starts with "F" and ends with "B" return "FizzBuzz". In other cases return the original string. In other cases return the original string.

Sample Input: "FizzBuzz" "Fizz" "Buzz" "Founder" Expected Output:

Fizz Fizz Buzz Fizz Click me to see the solution 47. Write a C# Sharp program to check if it is possible to add two integers to get the third integer from three given integers.

Sample Input: 1, 2, 3 4, 5, 6 -1, 1, 0 Expected Output:

True False True Click me to see the solution 48. Write a C# Sharp program to check if y is greater than x, and z is greater than y from three given integers x,y,z.

Sample Input: 1, 2, 3 4, 5, 6 -1, 1, 0 Expected Output:

True True False Click me to see the solution 49. Write a C# Sharp program to check if three given numbers are in strict increasing order. For example, 4 7 15, or 45, 56, 67, but not 4 ,5, 8 or 6, 6, 8. However, if a fourth parameter is true, equality is allowed, such as 6, 6, 8 or 7, 7, 7.

Sample Input: 1, 2, 3, false 1, 2, 3, true 10, 2, 30, false 10, 10, 30, true Expected Output:

True True False True Click me to see the solution 50. Write a C# Sharp program to check if two or more integers that are not negative have the same rightmost digit.

Sample Input: 11, 21, 31 11, 22, 31 11, 22, 33 Expected Output:

True True False Click me to see the solution 51. Write a C# Sharp program to check three given integers and return true if one of them is 20 or more less than one of the others.

Sample Input: 11, 21, 31 11, 22, 31 10, 20, 15 Expected Output:

True True False Click me to see the solution 52. Write a C# Sharp program to find the largest of two given integers. However if the two integers have the same remainder when divided by 7, then return the smallest integer. If the two integers are the same, return 0.

Sample Input: 11, 21 11, 20 10, 10 Expected Output:

21 20 0 Click me to see the solution 53. Write a C# Sharp program to check two given integers, each in the range 10..99. Return true if a digit appears in both numbers, such as the 3 in 13 and 33.

Sample Input: 11, 21 11, 20 10, 10 Expected Output:

True False True Click me to see the solution 54. Write a C# Sharp program to compute the sum of two given non-negative integers x and y as long as the sum has the same number of digits as x. If the sum has more digits than x return x without y.

Sample Input: 4, 5 7, 4 10, 10 Expected Output:

9 7 20 Click me to see the solution 55. Write a C# Sharp program to compute the sum of three given integers. Return the third value if the two values are the same.

Sample Input: 4, 5, 7 7, 4, 12 10, 10, 12 12, 12, 18 Expected Output:

16 23 12 18 Click me to see the solution 56. Write a C# Sharp program to compute the sum of the three integers. If one of the values is 13 then do not count it and its right towards the sum.

Sample Input: 4, 5, 7 7, 4, 12 10, 13, 12 13, 12, 18 Expected Output:

16 23 10 0 Click me to see the solution 57. Write a C# Sharp program to compute the sum of the three given integers. All values in the range 10..20 inclusive count as 0, except 13 and 17.

Sample Input: 4, 5, 7 7, 4, 12 10, 13, 12 14, 15, 16 Expected Output:

16 11 13 0 Click me to see the solution 58. Write a C# Sharp program to check two integers and return the value nearest to 13 without crossing over. Return 0 if both numbers exceed.

Sample Input: 4, 5 7, 12 10, 13 17, 33 Expected Output:

5 12 13 0 Click me to see the solution 59. Write a C# Sharp program to compare three integers (small, medium, and large) and return true if the difference between small and medium and the difference between medium and large is the same.

Sample Input: 4, 5, 6 7, 12, 13 -1, 0, 1 Expected Output:

True False True Click me to see the solution 60. Write a C# Sharp program to create a string using the two given strings s1, s2. The new string format will be s1s2s2s1.

Sample Input: "Hi", "Hello" "whats", "app" Expected Output:

HiHelloHelloHi whatsappappwhats Click me to see the solution 61. Write a C# Sharp program to insert a given string into the middle of another given string of length 4.

Sample Input: "[[]]","Hello" "(())", "Hi" Expected Output:

[[Hello]] ((Hi)) Click me to see the solution 62. Write a C# Sharp program to create a string using three copies of the last two characters of a given string of length at least two.

Sample Input: "Hello" "Hi" Expected Output:

lololo HiHiHi Click me to see the solution 63. Write a C# Sharp program to create a new string using the first two characters of a given string. If the string length is less than 2, return the original string.

Sample Input: "Hello" "Hi" "H" " " Expected Output:

He Hi H Click me to see the solution 64. Write a C# Sharp program to create a string from the first half of a given string of even length.

Sample Input: "Hello" "Hi" Expected Output:

He H Click me to see the solution 65. Write a C# Sharp program to create a new string without the first and last character of a given string of length at least two.

Sample Input: "Hello" "Hi" "Python" Expected Output:

ell

ytho Click me to see the solution 66. Write a C# Sharp program to create a new string from two given strings, one of which is shorter and one of which is longer. The new string format will be long string + short string + long string.

Sample Input: "Hello", "Hi" "JS", "Python" Expected Output:

HelloHiHello PythonJSPython Click me to see the solution 67. Write a C# Sharp program to combine two strings of length at least 1, after removing their first character.

Sample Input: "Hello", "Hi" "JS", "Python" Expected Output:

elloi Sython Click me to see the solution 68. Write a C# Sharp program to move the first two characters to the end of a given string of length at least two.

Sample Input: "Hello" "JS" Expected Output:

lloHe JS Click me to see the solution 69. Write a C# Sharp program to move the last two characters to the start of a given string of length at least two.

Sample Input: "Hello" "JS" Expected Output:

loHel JS Click me to see the solution 70. Write a C# Sharp program to create a new string without the first and last characters of a given string of any length.

Sample Input: "Hello" "JS" "" Expected Output:

ell Click me to see the solution 71. Write a C# Sharp program to create a string using the two middle characters of a given string of even length (at least 2).

Sample Input: "Hell" "JS" Expected Output:

el JS Click me to see the solution 72. Write a C# Sharp program to check if a given string ends with "on".

Sample Input: "Hello" "Python" "on" "o"

Expected Output:

False True True False Click me to see the solution 73. Write a C# Sharp program to create a new string using the first and last n characters from a given string of length at least n.

Sample Input: "Hello", 1 "Python", 2 "on", 1 "o", 1 Expected Output:

Ho Pyon on oo Click me to see the solution 74. Write a C# Sharp program to create a new string of length 2 starting at the given index of a given string.

Sample Input: "Hello", 1 "Python", 2 "on", 1 Expected Output:

el th on Click me to see the solution 75. Write a C# Sharp program to create a string by taking at least 3 characters from the middle of a given string.

Sample Input: "Hello" "Python" "abc" Expected Output:

ell yth abc Click me to see the solution 76. Write a C# Sharp program to create a new string of length 2, using the first two characters of a given string. If the given string length is less than 2 use '#' as missing characters.

Sample Input: "Hello" "Python" "a" "" Expected Output:

He Py a#

Click me to see the solution 77. Write a C# Sharp program to create a string by taking the first character from a string and the last character from another string. If a string's length is 0, use '#' as its missing character.

Sample Input: "Hello", "Hi" "Python", "PHP" "JS", "JS" "Csharp", "" Expected Output:

Hi PP JS C# Click me to see the solution 78. Write a C# Sharp program to combine two given strings (lowercase). If there are any double characters in the string, omit one character.

Sample Input: "abc", "cat" "python", "php" "php", "php" Expected Output:

abcat pythonphp phphp Click me to see the solution 79. Write a C# Sharp program to create a new string from a given string after swapping the last two characters.

Sample Input: "Hello" "Python" "PHP" "JS" "C" Expected Output:

Helol Pythno PPH SJ C Click me to see the solution 80. Write a C# Sharp program to check if a given string begins with 'abc' or 'xyz'. If the string begins with 'abc' or 'xyz' return 'abc' or 'xyz' otherwise return an empty string.

Sample Input: "abc" "abcdef" "C" "xyz" "xyzsder" Expected Output:

abc abc

xyz xyz Click me to see the solution 81. Write a C# Sharp program to check whether the first two characters and the last two characters of a given string are the same.

Sample Input: "abab" "abcdef" "xyzsderxy" Expected Output:

True False True Click me to see the solution 82. Write a C# Sharp program to combine two given strings. If the given strings have different lengths remove the characters from the longer string.

Sample Input: "abc", "abcd" "Python", "Python" "JS", "Python" Expected Output:

abcbcd PythonPython JSon Click me to see the solution 83. Write a C# Sharp program to create a new string using 3 copies of the first 2 characters of a given string. If the string length is less than 2 use the whole string.

Sample Input: "abc" "Python" "J" Expected Output:

ababab PyPyPy JJJ Click me to see the solution 84. Write a C# Sharp program to create a new string from a string. In the case that the two characters at the beginning and end of the given string are the same, return the given string without the first two characters, otherwise return the original string.

Sample Input: "abcab" "Python" Expected Output:

cab Python Click me to see the solution 85. Write a C# Sharp program to create a new string from a given string without the first two characters. Keep the first character if it is "p" and keep the second character if it is "y".

Sample Input: "abcab" "python" "press" "jython" Expected Output:

cab python pess ython Click me to see the solution 86. Write a C# Sharp program to create a string from a given string without the first and last character. This is if the first or last characters are 'a' otherwise return the original given string.

Sample Input: "abcab" "python" "abcda" "jython" Expected Output:

bcab python bcd jython Click me to see the solution 87. Write a C# Sharp program to create a new string from a given string. Return the string without the first or first two 'a' characters otherwise return the original string.

Sample Input: "abcab" "python" "aacda" "jython" Expected Output:

bcab python cda jython Click me to see the solution 88. Write a C# Sharp program to check a given array of integers of length 1 or more. Return true if 10 appears as either the first or last element in the given array.

Sample Input: { 10, 20, 40, 50 } { 5, 20, 40, 10 } { 10, 20, 40, 10 } { 12, 24, 35, 55 } Expected Output:

True True True False Click me to see the solution 89. Write a C# Sharp program to check a given array of integers of length 1 or more. Return true if the first and the last element in the array are equal.

Sample Input: { 10, 20, 40, 50 } { 10, 20, 40, 10 } { 12, 24, 35, 55 } Expected Output:

False True False Click me to see the solution 90. Write a C# Sharp program to check two given arrays of integers of length 1 or more. Return true if they have the same first element or the same last element.

Sample Input: { 10, 20, 40, 50 }, { 10, 20, 40, 50 } { 10, 20, 40, 50 }, { 10, 20, 40, 5 } { 10, 20, 40, 50 }, { 1, 20, 40, 5 } Expected Output:

True True False Click me to see the solution 91. Write a C# Sharp program to compute the sum of the elements of an array of integers.

Sample Input: { 10, 20, 30, 40, 50 } { 10, 20, -30, -40, 50 } Expected Output:

150 10 Click me to see the solution 92. Write a C# Sharp program to rotate the elements of a given array of integers (length 4 ) in the left direction and return the array.

Sample Input: { 10, 20, -30, -40 } Expected Output:

Rotated array: 20 -30 -40 10 Click me to see the solution

  1. Write a C# Sharp program to reverse a given array of integers and length 5.

Sample Input: { 10, 20, -30, -40, 50 } Expected Output:

Reverse array: 50 -40 -30 20 10 Click me to see the solution 94. Write a C# Sharp program to find out the maximum element between the first and last element in a given array of integers ( length 4), replace all elements with the maximum element.

Sample Input: { 10, 20, -30, -40 } Expected Output:

New array: 20 20 20 20 Click me to see the solution 95. Write a C# Sharp program to create an array containing the middle elements from the two given arrays of integers, each length 5.

Sample Input: { 10, 20, -30, -40, 30 }, { 10, 20, 30, 40, 30 } Expected Output:

New array: -30 30 Click me to see the solution 96. Write a C# Sharp program to create an array taking the first and last elements of a given array of integers and length 1 or more.

Sample Input: { 10, 20, -30, -40, 30 } Expected Output :

New array: 10 30 Click me to see the solution 97. Write a C# Sharp program to check if an array of integers length 2 contains 15 or 20.

Sample Input: { 12, 20 } { 14, 15 } { 11, 21 } Expected Output :

True True False Click me to see the solution 98. Write a C# Sharp program to check if an array of integers with length 2 does not contain 15 or 20.

Sample Input: { 12, 20 } { 14, 15 } { 11, 21 } Expected Output :

False False True Click me to see the solution 99. Write a C# Sharp program to create an array of integers with a length of 1 or more. The array length will be double the given array length. All the elements are 0 except the first element which is equal to the given array.

Sample Input: { 10, 20, -30, -40, 30 } Expected Output :

New array: 10 0 0 0 0 0 0 0 0 0 Click me to see the solution 100. Write a C# Sharp program to check a given array of integers and return true if it contains 10 or 20 twice. The array length will be 0, 1, or 2.

Sample Input: { 12, 20 } { 20, 20 } { 10, 10 } { 10 } Expected Output :

False True True False Click me to see the solution 101. Write a C# Sharp program to check a given array of integers length 3 and create a array. If there is a 5 in the given array immediately followed by a 7 then set 7 to 1.

Sample Input: { 1, 5, 7 } Expected Output :

Original array: 1, 5, 7 New array: 1 5 1 Click me to see the solution 102. Write a C# Sharp program to compute the sum of the two given arrays of integers, length 3. Find the array with the largest sum.

Sample Input: { 10, 20, -30 }, { 10, 20, 30 } Expected Output :

Original array: 1, 5, 7 Larger array: 10 20 30 Click me to see the solution 103. Write a C# Sharp program to create an array taking two middle elements from a given array of integers of length even.

Sample Input: { 1, 5, 7, 9, 11, 13 } Expected Output:

Original array: 1, 5, 7, 9, 11, 13 New array: 7 9 Click me to see the solution 104. Write a C# Sharp program to create an array from two arrays of integers, each length 3.

Sample Input: { 10, 20, 30 }, { 40, 50, 60 } Expected Output :

Array 1: 10, 20, 30 Array 2: 40, 50, 60 New array: 10 20 30 40 50 60 Click me to see the solution 105. Write a C# Sharp program to create an array by swapping the first and last elements of a given array of integers with a length of at least 1.

Sample Input: { 1, 5, 7, 9, 11, 13 } Expected Output :

Original array: 1, 5, 7, 9, 11, 13 After swapping first and last elements: 13 5 7 9 11 1 Click me to see the solution 106. Write a C# Sharp program to create an array length 3 from a given array (length at least 3) using the elements in the middle of the array.

Sample Input: { 1, 5, 7, 9, 11, 13 } Expected Output :

Original array: 1, 5, 7, 9, 11, 13 New array: 7 9 11 Click me to see the solution 107. Write a C# Sharp program to find the largest value from first, last, and middle elements of a given array of integers of odd length (at least 1).

Sample Input: {1} {1,2,9} {1,2,9,3,3} {1,2,3,4,5,6,7} {1,2,2,3,7,8,9,10,6,5,4} Expected Output :

1 9 9 7 8 Click me to see the solution 108. Write a C# Sharp program to create an array by taking the first two elements from an array. If the given array length is shorter than 2, return the given array.

Sample Input: { 1, 5, 7, 9, 11, 13 } Expected Output :

New array: 1 5 Click me to see the solution 109. Write a C# Sharp program to count the even number of elements in a given array of integers.

Sample Input: { 1, 5, 7, 9, 10, 12 } Expected Output :

Original array: 1, 5, 7, 9, 10, 12 2 Click me to see the solution 110. Write a C# Sharp program to compute the difference between the largest and smallest values in a given array of integers and lengths of one or more.

Sample Input: { 1, 5, 7, 9, 10, 12 } Expected Output:

Original array: 1, 5, 7, 9, 10, 12 Difference between the largest and smallest values: 11 Click me to see the solution 111. Write a C# Sharp program to compute the sum of values in a given array of integers except 17. Return 0 if the given array has no integers.

Sample Input: { 1, 5, 7, 9, 10, 17 } Expected Output :

Original array: 1, 5, 7, 9, 10, 17 Sum of values in the array of integers except the number 17: 32 Click me to see the solution 112. Write a C# Sharp program to compute the sum of the numbers in a given array except those that begin with 5 followed by at least one 6. Return 0 if the given array has no integers.

Sample Input: { 5, 6, 1, 5, 6, 9, 10, 17, 5, 6 } { 5, 6, 1, 5, 6, 9, 10, 17 } { 1, 5, 6, 9, 10, 17, 5, 6 } { 1, 5, 9, 10, 17, 5, 6 } { 1, 5, 9, 10, 17, 5} Expected Output :

Sum of the numbers of the said array except those numbers starting with 5 followed by atleast one 6: 37 37 37 42 47 Click me to see the solution 113. Write a C# Sharp program to check if a given array of integers contains 5 next to a 5 somewhere.

Sample Input: { 1, 5, 6, 9, 10, 17 } { 1, 5, 5, 9, 10, 17 } { 1, 5, 5, 9, 10, 17, 5, 5 } Expected Output :

False True True Click me to see the solution 114. Write a C# Sharp program to check whether a given array of integers contains 5's and 7's.

Sample Input: { 1, 5, 6, 9, 10, 17 } { 1, 4, 7, 9, 10, 17 } { 1, 1, 2, 9, 10, 17} Expected Output :

True True False Click me to see the solution 115. Write a C# Sharp program to check if the sum of all 5' in the array is exactly 15 in a given array of integers.

Sample Input: { 1, 5, 6, 9, 10, 17 } { 1, 5, 5, 5, 10, 17 } { 1, 1, 5, 5, 5, 5} Expected Output :

False True False Click me to see the solution 116. Write a C# Sharp program to check if the number of 3's is greater than the number of 5's.

Sample Input: { 1, 5, 6, 9, 3, 3 } { 1, 5, 5, 5, 10, 17 } { 1, 3, 3, 5, 5, 5} Expected Output :

True False False Click me to see the solution 117. Write a C# Sharp program to check if a given array of integers contains a 3 or a 5.

Sample Input: { 5, 5, 5, 5, 5 } { 3, 3, 3, 3 } { 3, 3, 3, 5, 5, 5} { 1, 6, 8, 10} Expected Output :

True True True False Click me to see the solution 118. Write a C# Sharp program to check if a given array of integers contains no 3 or 5.

Sample Input: { 5, 5, 5, 5, 5 } { 3, 3, 3, 3 } { 3, 3, 3, 5, 5, 5} { 1, 6, 8, 10} Expected Output :

True True False True Click me to see the solution 119. Write a C# Sharp program to check if an array of integers contains a 3 next to a 3 or a 5 next to a 5 or both.

Sample Input: { 5, 5, 5, 5, 5 } { 1, 2, 3, 4 } { 3, 3, 5, 5, 5, 5} { 1, 5, 5, 7, 8, 10} Expected Output :

True False True True Click me to see the solution 120. Write a C# Sharp program to check a given array of integers. Return true if the given array contains two 5's next to each other, or two 5's separated by one element.

Sample Input: { 5, 5, 1, 5, 5 } { 1, 2, 3, 4 } { 3, 3, 5, 5, 5, 5} { 1, 5, 5, 7, 8, 10} Expected Output :

True False True True Click me to see the solution 121. Write a C# Sharp program to check a given array of integers and return true if there is a 3 with a 5 somewhere later in the given array.

Sample Input: { 3, 5, 1, 3, 7 } { 1, 2, 3, 4 } { 3, 3, 5, 5, 5, 5} { 2, 5, 5, 7, 8, 10} Expected Output :

True False True False Click me to see the solution 122. Write a C# Sharp program to check a given array of integers. Return true if the given array contains 2 even or 2 odd values all next to each other.

Sample Input: { 3, 5, 1, 3, 7 } { 1, 2, 3, 4 } { 3, 3, 5, 5, 5, 5} { 2, 4, 5, 6} Expected Output :

True False True True Click me to see the solution 123. Write a C# Sharp program to check a given array of integers and return true if 5 appears 5 times. There are no 5 next to each other.

Sample Input: { 3, 5, 1, 5, 3, 5, 7, 5, 1, 5 } { 3, 5, 5, 5, 5, 5, 5 } { 3, 5, 2, 5, 4, 5, 7, 5, 8, 5 } { 2, 4, 5, 5, 5, 5 } { 3, 5, 5, 5, 5, 5, 5, 5, 5, 5 } Expected Output :

True False True False False Click me to see the solution 124. Write a C# Sharp program to check a given array of integers. Return true if every 5 in the given array is next to another 5.

Sample Input: { 3, 5, 5, 3, 7 } { 3, 5, 5, 4, 1, 5, 7} { 3, 5, 5, 5, 5, 5} { 2, 4, 5, 5, 6, 7, 5} Expected Output :

True False True False Click me to see the solution 125. Write a C# Sharp program to check a given array of integers. Return true if the specified number of same elements appears at the start and end of the given array.

Sample Input: { 3, 7, 5, 5, 3, 7 }, 2 { 3, 7, 5, 5, 3, 7 }, 3 { 3, 7, 5, 5, 3, 7, 5 }, 3 Expected Output :

True False True Click me to see the solution 126. Write a C# Sharp program to check a given array of integers and return true if the array contains three increasing adjacent numbers.

Sample Input: { 1, 2, 3, 5, 3, 7 } { 3, 7, 5, 5, 3, 7 } { 3, 7, 5, 5, 6, 7, 5 } Expected Output :

True False True Click me to see the solution 127. Write a C# Sharp program to shift an element left and return an array.

Sample Input: { 10, 20, -30, -40, 50 } Expected Output :

New array: 20 -30 -40 50 10 Click me to see the solution 128. Write a C# Sharp program to create an array taking the elements before 5 from a given array of integers.

Sample Input: { 1, 2, 3, 5, 7 } Expected Output :

New array: 1 2 3 Click me to see the solution 129. Write a C# Sharp program to create an array by taking the elements after element value 5 from a given array of integers.

Sample Input: { 1, 2, 3, 5, 7, 9, 11 } Expected Output :

New array: 7 9 11 Click me to see the solution 130. Write a C# Sharp program to create an array from a given array of integers by shifting all zeros to the left direction.

Sample Input: { 1, 2, 0, 3, 5, 7, 0, 9, 11 } Expected Output :

New array: 0 0 1 3 5 7 2 9 11 Click me to see the solution 131. Write a C# Sharp program to create an array after replacing all values 5 with 0 and shifting all zeros to the right.

Sample Input: { 1, 2, 5, 3, 5, 7, 5, 9, 11 } Expected Output :

New array: 1 2 3 7 9 11 0 0 0 Click me to see the solution 132. Write a C# Sharp program to create an array from a given array of integers. Shift all even numbers before all odd numbers.

Sample Input: { 1, 2, 5, 3, 5, 4, 6, 9, 11 } Expected Output :

New array: 2 4 6 3 5 1 5 9 11 Click me to see the solution 133. Write a C# Sharp program to check if the value of each element is equal or greater than the value of the previous element in a given array of integers.

Sample Input: { 5, 5, 1, 5, 5 } { 1, 2, 3, 4 } { 3, 3, 5, 5, 5, 5} { 1, 5, 5, 7, 8, 10} Expected Output:

False True True True Click me to see the solution 134. Write a C# Sharp program to check a given array (length will be at least 2) of integers and return true if there are two values 15, 15 next to each other.

Sample Input: { 5, 5, 1, 15, 15 } { 15, 2, 3, 4, 15 } { 3, 3, 15, 15, 5, 5} { 1, 5, 15, 7, 8, 15} Expected Output :

True False True False Click me to see the solution 135. Write a C# Sharp program to find the largest average value between the first and second half of a given array of integers. Minimum length is at least 2. Assume that the second half begins at index (array length)/2.

Sample Input: { 1, 2, 3, 4, 6, 8 } { 15, 2, 3, 4, 15, 11 } Expected Output:

6 10 Click me to see the solution 136. Write a C# Sharp program to count the number of strings with given lengths in a given array of strings.

Sample Input: {"a", "b", "bb", "c", "ccc" }, 1 Expected Output:

Number of Strings: 3 Click me to see the solution 137. Write a C# Sharp program to create an array using the first n strings from a given array of strings. (n>=1 and <=length of the array).

Sample Input: {"a", "b", "bb", "c", "ccc" }, 3 Expected Output :

New array: a b bb Click me to see the solution 138. Write a C# Sharp program to create an array from a given array of strings. This is done using all the strings whose lengths matches given string length.

Sample Input: {"a", "aaa", "b", "bbb", "c", "ccc" }, 3 Expected Output :

New array: aaa bbb ccc Click me to see the solution 139. Write a C# Sharp program to check a positive integer and return true if it contains a number 2.

Sample Input: 123 13 222 Expected Output:

True False True Click me to see the solution 140. Write a C# Sharp program to create an array of given length using odd numbers from a given array of positive integers.

Sample Input: {1,2,3,5,7,9,10},3 Expected Output:

New array: 1 3 5 Click me to see the solution 141. Write a C# Sharp program to create a list from a given list of integers where each element is multiplied by 3.

Sample Input: { 1, 2, 3 , 4 } Expected Output :

New array: 3 6 9 12 Click me to see the solution 142. Write a C# Sharp program to create a list from a given list of integers. Each integer is multiplied by itself three times.

Sample Input: { 1, 2, 3 , 4 } Expected Output:

New array: 1 8 27 64 Click me to see the solution 143. Write a C# Sharp program to create a list from a given list of strings. Each element has "#" added at the beginning and end position.

Sample Input: { "1", "2", "3" , "4" } Expected Output :

#1# #2# #3# #4# Click me to see the solution 144. Write a C# Sharp program to create a list from a given list of strings. Each element is replaced by 4 copies of the string concatenated together.

Sample Input: { "1", "2", "3" , "4" } Expected Output :

1111 2222 3333 4444 Click me to see the solution 145. Write a C# Sharp program to create a list from a given list of integers. In this program, each integer value is added to 2 and the resulting value is multiplied by 5.

Sample Input: { 1, 2, 3 , 4 } Expected Output :

15 20 25 30 Click me to see the solution 146. Write a C# Sharp program to create a list of the rightmost digits from a given list of positive integers.

Sample Input: { 10, 22, 35 , 41 } Expected Output:

0 2 5 1 Click me to see the solution 147. Write a C# Sharp program to create a list from a given list of strings. Strings will be in upper case in the new string.

Sample Input: { "Abc", "cdef", "js" , "php" } Expected Output :

ABC CDEF JS PHP Click me to see the solution 148. Write a C# Sharp program to remove all "a"s from each string in a given list of strings and return the result string.

Sample Input: { "abc", "cdaef", "js" , "php" } Expected Output :

bc cdef js php Click me to see the solution 149. Write a C# Sharp program to create a list from a given list of integers removing those values less than 4.

Sample Input: { 0, -2, 1, 2, 3, 5 , 4, 7, 8 } Expected Output :

0 -2 1 2 3 Click me to see the solution 150. Write a C# Sharp program to create a list from a given list of integers, removing all values ending in 7.

Sample Input: { 10, 22, 35 , 47, 53, 67 } Expected Output :

10 22 35 53 Click me to see the solution C# Sharp Code Editor:

More to Come !



Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/csharp-exercises/basic-algo/index.php

Copy! Weekly Trends and Language Statistics Weekly Trends and Language Statistics Load Disqus Comments This work is licensed under a Creative Commons Attribution 4.0 International License. ©w3resource.com 2011-2024 PrivacyAboutContactFeedbackAdvertise

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages