Skip to content

Instantly share code, notes, and snippets.

@bharathmuddada
bharathmuddada / StringReversal.cs
Created July 18, 2022 15:03
Reversing String
public class StringReversal
{
public static void Main(String[] args)
{
string courseName1 = "Automation";
//Reversing String Approach -01
for (int i = courseName1.Length-1;i>=0 ; i--) {
@bharathmuddada
bharathmuddada / JaggedArraySample.cs
Created July 18, 2022 14:06
Accessing elements from jagged Array
public class JaggedArraySample
{
public static void Main(String[] args)
{
var jaggedArray = new int[][] {
new int[] {1,2,3 },
new int[] {4,5,6,7 },
new int[] {8,9,10,11,12}
};
@bharathmuddada
bharathmuddada / RectangularArray.cs
Created July 18, 2022 13:55
Access elements from rectangular Array
public class RectangularArray
{
public static void Main(String[] args)
{
var rectangularArray = new int[,] {
{1,2,3 },
{4,5,6 },
{7,8,9}
};
@bharathmuddada
bharathmuddada / PalindromeCheck.cs
Created July 15, 2022 03:11
Check whether given string is palindrome
public class PalindromeCheck
{
public static void Main(String[] args)
{
// Palindrome -- Level
//1. Reverse string.
//2. Compare the reversedstring with actual string.
string actualString = "level";
@bharathmuddada
bharathmuddada / SwitchCaseExample.cs
Created July 14, 2022 06:18
Example program for switch case
public class SwitchCaseExample
{
public static void Main(String[] args)
{
Console.WriteLine("Enter any of the 3 seasons Summer , Winter, Rainy ");
string season = Console.ReadLine();
switch (season) {
case "Summer":
Console.WriteLine($"{season} lasts from March to May");
break;
@bharathmuddada
bharathmuddada / RightAngleTriangle.cs
Created July 14, 2022 06:01
Print a star right angle triangle
public class RightAngleTriangle
{
public static void Main(String[] args)
{
Console.WriteLine("Right angle triangle : ");
int n = 5;
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= i; j++)
{
@bharathmuddada
bharathmuddada / StarPyramid.cs
Last active July 14, 2022 05:59
Print a star pyramid
public class StarPyramid
{
public static void Main(String[] args)
{
Console.WriteLine("Triangle : ");
int n = 5;
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= (n - i); j++)
{
@bharathmuddada
bharathmuddada / FizzBuzz.py
Created October 31, 2021 04:53
FizzBuzz in python
number = int(input("enter your number "))
if (number%3 ==0 and number%5 ==0):
print("FizzBuzz")
elif(number%3 ==0):
print("Buzz")
elif(number%5 ==0):
print("Fizz")
else:
print(number)
@bharathmuddada
bharathmuddada / FizzBuzz.java
Created October 31, 2021 04:35
FizzBuzz in Java
public class FizzBuzz {
public static void main(String [] args){
Scanner scanner = new Scanner(System.in);
System.out.println("Number");
int Number = scanner.nextInt();
if(Number%3==0 && Number%5==0)
System.out.println("FIZZBUZZ");
else if(Number%5==0)
@bharathmuddada
bharathmuddada / LeftRotateList.py
Created May 29, 2021 12:53
Left Rotate List in python
l=[10,20,30,40]
def leftrotate(l):
s = 1
e = len(l) - 1
temp = l[0]
print(l[e])
while s < len(l):
print(s)
l[s-1] =l[s]