This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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--) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RectangularArray | |
{ | |
public static void Main(String[] args) | |
{ | |
var rectangularArray = new int[,] { | |
{1,2,3 }, | |
{4,5,6 }, | |
{7,8,9} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PalindromeCheck | |
{ | |
public static void Main(String[] args) | |
{ | |
// Palindrome -- Level | |
//1. Reverse string. | |
//2. Compare the reversedstring with actual string. | |
string actualString = "level"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |