11. Write a program to reverse a hardcoded string.
Required Input:
String: "hello"
Expected Output:
Reversed String: olleh
Code In C#
using System;
class ReverseString
{
static void Main()
{
// Reverse the hardcoded string
}
}
Run Code?
Click Run Button to view compiled output
12. Create a program to count the number of vowels in a hardcoded string.
Required Input:
String: "programming"
Expected Output:
Number of Vowels: 3
Code In C#
using System;
class CountVowels
{
static void Main()
{
// Count vowels in the string
}
}
Run Code?
Click Run Button to view compiled output
13. Write a program to check if a hardcoded string is a palindrome.
Required Input:
String: "madam"
Expected Output:
Is Palindrome: True
Code In C#
using System;
class CheckPalindrome
{
static void Main()
{
// Check if the string is a palindrome
}
}
Run Code?
Click Run Button to view compiled output
14. Create a program to print the Fibonacci sequence up to a hardcoded number of terms.
Required Input:
Terms: 6
Expected Output:
Fibonacci Sequence: 0 1 1 2 3 5
Code In C#
using System;
class FibonacciSequence
{
static void Main()
{
// Print Fibonacci sequence
}
}
Run Code?
Click Run Button to view compiled output
15. Write a program to find the sum of all elements in a hardcoded array.
Required Input:
Array: [1, 2, 3, 4, 5]
Expected Output:
Sum of Elements: 15
Code In C#
using System;
class ArraySum
{
static void Main()
{
// Calculate the sum of array elements
}
}
Run Code?
Click Run Button to view compiled output
16. Create a program to find the smallest and largest elements in a hardcoded array.
Required Input:
Array: [4, 1, 7, 3, 9]
Expected Output:
Smallest: 1, Largest: 9
Code In C#
using System;
class MinMaxArray
{
static void Main()
{
// Find smallest and largest elements in the array
}
}
Run Code?
Click Run Button to view compiled output
17. Write a program to sort a hardcoded array in ascending order.
Required Input:
Array: [5, 2, 8, 1, 3]
Expected Output:
Sorted Array: 1, 2, 3, 5, 8
Code In C#
using System;
class SortArray
{
static void Main()
{
// Sort the array in ascending order
}
}
Run Code?
Click Run Button to view compiled output
18. Create a program to find the GCD of two hardcoded numbers.
Required Input:
Numbers: 56 and 98
Expected Output:
GCD: 14
Code In C#
using System;
class FindGCD
{
static void Main()
{
// Calculate the GCD of two numbers
}
}
Run Code?
Click Run Button to view compiled output
19. Write a program to find the LCM of two hardcoded numbers.
Required Input:
Numbers: 15 and 20
Expected Output:
LCM: 60
Code In C#
using System;
class FindLCM
{
static void Main()
{
// Calculate the LCM of two numbers
}
}
Run Code?
Click Run Button to view compiled output
20. Create a program to count the number of words in a hardcoded string.
Required Input:
String: "Hello World, welcome to C#"
Expected Output:
Word Count: 5
Code In C#
using System;
class WordCount
{
static void Main()
{
// Count the number of words in the string
}
}
Run Code?
Click Run Button to view compiled output