This is Not AD.
Join Our Telegram Channel To Get OUR all Material Up to Date.
Don't Worry Your All Info Will Be Secured
Home About Us Services Materials Contact Us
Home About Services Materials Contact
‹
›
Home
Home > C# | SU [ 11 - 20 ] [ FOR JOURNAL ]
CODE

using System;

class Factorial
{
    static void Main()
    {  
        Console.WriteLine("\n Enter Factorial No. : ");
        long n = Convert.ToInt32(Console.ReadLine());
        long fact = 1 ; 
        for (long i = 1; i <= n; i++)
        {
            fact *= i;
        }
        Console.WriteLine(fact);
    }
}
                
OUTPUT

Enter Factorial No. : 6

720
                    
CODE

using System;

class SumOfDigits
{
    static void Main()
    {
        Console.WriteLine("\n Enter Digit No. : ");
        long n = Convert.ToInt64(Console.ReadLine());
        long sum = 0;

        while(n != 0)
        {
            if(n > 0)
            {
            sum = sum + (n % 10);  
            n = n / 10;
            }
        }
        Console.WriteLine(sum);
    }
}
                
OUTPUT

Enter Digit No. : 690

15
                    
CODE

using System;

class Program
{
    static void Main()
    {
        int n, r, sum = 0, temp;

        Console.Write("Enter a number: ");
        n = int.Parse(Console.ReadLine()); 

        temp = n; 

        
        while (n > 0)
        {
            r = n % 10;          
            sum = (sum * 10) + r; 
            n = n / 10;          
        }

  
        if (temp == sum)
            Console.Write("It is a Palindrome.");
        else
            Console.Write("It is NOT a Palindrome.");
    }
}
                
OUTPUT

Enter a number: 12321
It is a Palindrome.
                    
CODE

using System;

class Prime
{ 
    static void Main()
    {
        for (int number = 2; number <= 100; number++)
        {
            int isPrime = 1;
            for (int i = 2; i * i <= number; i++)
            {
                if (number % i == 0)
                {
                    isPrime = 0;
                    break;
                }
            }

            if (isPrime == 1)
            {
                Console.WriteLine(number + " Prime");
            }
        }
    }
}
                
OUTPUT

2 Prime
3 Prime
5 Prime
7 Prime
11 Prime
13 Prime
17 Prime
19 Prime
23 Prime
29 Prime
31 Prime
37 Prime
41 Prime
43 Prime
47 Prime
53 Prime
59 Prime
61 Prime
67 Prime
71 Prime
73 Prime
79 Prime
83 Prime
89 Prime
97 Prime
                    
CODE

using System;

class ForEach
{
    static void Main()
    {
        Console.Write("Enter Range : ");
        int n = Convert.ToInt32(Console.ReadLine());
        
        string[] name = new string[n];

        for(int i = 0; i < n; i++)
        {
            Console.Write("Enter Name[" + i + "] : ");
            name[i] = (Console.ReadLine());   
        }
        Console.WriteLine("*-*-*-*-*-*-*-*-*-*-*-*-*-*");
        foreach(string names in name)
        {
            Console.WriteLine(names);
        }
    }
}
                
OUTPUT

Enter Range : 3
Enter Name[0] : Gemini
Enter Name[1] : Copilot
Enter Name[2] : Claude

*-*-*-*-*-*-*-*-*-*-*-*-*-*

Gemini
Copilot
Claude
                    
CODE

using System;

class OneDimensional
{
    static void Main()
    {
        int[] arr = {1, 2, 3, 4, 5};

        for(int i = 0 ; i < arr.Length ; i++)
        {
            Console.WriteLine(i+" > " + arr[i]);
        }
    }
}
                
OUTPUT

0 > 1
1 > 2
2 > 3
3 > 4
4 > 5

                    
CODE

using System;

class TwoDimensional
{
    static void Main()
    {
        //Console.WriteLine("Enter No of Div = ");
        //int i = Convert.ToInt32(Console.ReadLine());
        //Console.WriteLine("Enter No of Student");
        //int j = Convert.ToInt32(Console.ReadLine());

        int[,] arr =

        {
            { 1, 2, 3 } ,  // 2 row
            { 4, 5, 6 } ,  // 3 column
        };

        for (int i = 0; i < arr.GetLength(0); i++)
        {
            for (int j = 0; j < arr.GetLength(1); j++)
            {
                Console.Write(arr[i, j]);
            }
            Console.WriteLine();
        }
    }
}

                
OUTPUT

123
456

                    
CODE

using System;

class Jagged
{
    static void Main()
    {
        int[][] arr = new int[5][];

        arr[0] = new int[] { 1, 2, 3 };
        arr[1] = new int[] { 4, 5, 6 };
        arr[2] = new int[] { 7, 8, 9 };
        arr[3] = new int[] { 10, 11, 12 };
        arr[4] = new int[] { 13, 14, 15 };

        for (int i = 0; i < arr.Length; i++)
        {
            for(int j = 0; j < arr[i].Length; j++)
            {
                Console.Write(arr[i][j]+" ");
            }
            Console.WriteLine();
        }
    }
}
                
OUTPUT

1 2 3 
4 5 6 
7 8 9 
10 11 12 
13 14 15 
                    
CODE

using System;

class VowelsConsonantsCount
{
    static void Main()
    {
        char[] a = { 'a' , 'e' , 'i' , 'o' , 'u' };
        int Vcount = 0 , Ccount = 0;

        Console.Write("Enter String : ");
        string n = Console.ReadLine();

        for (int i = 0; i < n.Length; i++)
        {
            for (int j = 0; j < a.Length; j++)
            {
                if (n[i] == a[j])
                {
                    Vcount++;
                    break;
                }
                else
                {
                    Ccount = n.Length - Vcount;
                }
            }
        }

        //Ccount = n.Length - Vcount;

        Console.WriteLine("Vowels = "+Vcount);
        Console.WriteLine("Consonants = "+Ccount);

    }
}
                
OUTPUT

Enter String : Microsoft
Vowels = 3
Consonants = 6

                    
CODE

using System;

class ReverseString
{
    static void Main()
    {
        Console.Write("Enter String : ");
        string n = Console.ReadLine();

        for (int i = n.Length - 1 ; i > -1; i--)
        {
            Console.Write(n[i]);
        }
    }
}
                
OUTPUT

Enter String : Reverse
esreveR
                    

No comments:

Post a Comment

Thursday, 29 January 2026

C# | SU [ 11 - 20 ] [ FOR JOURNAL ]

CODE

using System;

class Factorial
{
    static void Main()
    {  
        Console.WriteLine("\n Enter Factorial No. : ");
        long n = Convert.ToInt32(Console.ReadLine());
        long fact = 1 ; 
        for (long i = 1; i <= n; i++)
        {
            fact *= i;
        }
        Console.WriteLine(fact);
    }
}
                
OUTPUT

Enter Factorial No. : 6

720
                    
CODE

using System;

class SumOfDigits
{
    static void Main()
    {
        Console.WriteLine("\n Enter Digit No. : ");
        long n = Convert.ToInt64(Console.ReadLine());
        long sum = 0;

        while(n != 0)
        {
            if(n > 0)
            {
            sum = sum + (n % 10);  
            n = n / 10;
            }
        }
        Console.WriteLine(sum);
    }
}
                
OUTPUT

Enter Digit No. : 690

15
                    
CODE

using System;

class Program
{
    static void Main()
    {
        int n, r, sum = 0, temp;

        Console.Write("Enter a number: ");
        n = int.Parse(Console.ReadLine()); 

        temp = n; 

        
        while (n > 0)
        {
            r = n % 10;          
            sum = (sum * 10) + r; 
            n = n / 10;          
        }

  
        if (temp == sum)
            Console.Write("It is a Palindrome.");
        else
            Console.Write("It is NOT a Palindrome.");
    }
}
                
OUTPUT

Enter a number: 12321
It is a Palindrome.
                    
CODE

using System;

class Prime
{ 
    static void Main()
    {
        for (int number = 2; number <= 100; number++)
        {
            int isPrime = 1;
            for (int i = 2; i * i <= number; i++)
            {
                if (number % i == 0)
                {
                    isPrime = 0;
                    break;
                }
            }

            if (isPrime == 1)
            {
                Console.WriteLine(number + " Prime");
            }
        }
    }
}
                
OUTPUT

2 Prime
3 Prime
5 Prime
7 Prime
11 Prime
13 Prime
17 Prime
19 Prime
23 Prime
29 Prime
31 Prime
37 Prime
41 Prime
43 Prime
47 Prime
53 Prime
59 Prime
61 Prime
67 Prime
71 Prime
73 Prime
79 Prime
83 Prime
89 Prime
97 Prime
                    
CODE

using System;

class ForEach
{
    static void Main()
    {
        Console.Write("Enter Range : ");
        int n = Convert.ToInt32(Console.ReadLine());
        
        string[] name = new string[n];

        for(int i = 0; i < n; i++)
        {
            Console.Write("Enter Name[" + i + "] : ");
            name[i] = (Console.ReadLine());   
        }
        Console.WriteLine("*-*-*-*-*-*-*-*-*-*-*-*-*-*");
        foreach(string names in name)
        {
            Console.WriteLine(names);
        }
    }
}
                
OUTPUT

Enter Range : 3
Enter Name[0] : Gemini
Enter Name[1] : Copilot
Enter Name[2] : Claude

*-*-*-*-*-*-*-*-*-*-*-*-*-*

Gemini
Copilot
Claude
                    
CODE

using System;

class OneDimensional
{
    static void Main()
    {
        int[] arr = {1, 2, 3, 4, 5};

        for(int i = 0 ; i < arr.Length ; i++)
        {
            Console.WriteLine(i+" > " + arr[i]);
        }
    }
}
                
OUTPUT

0 > 1
1 > 2
2 > 3
3 > 4
4 > 5

                    
CODE

using System;

class TwoDimensional
{
    static void Main()
    {
        //Console.WriteLine("Enter No of Div = ");
        //int i = Convert.ToInt32(Console.ReadLine());
        //Console.WriteLine("Enter No of Student");
        //int j = Convert.ToInt32(Console.ReadLine());

        int[,] arr =

        {
            { 1, 2, 3 } ,  // 2 row
            { 4, 5, 6 } ,  // 3 column
        };

        for (int i = 0; i < arr.GetLength(0); i++)
        {
            for (int j = 0; j < arr.GetLength(1); j++)
            {
                Console.Write(arr[i, j]);
            }
            Console.WriteLine();
        }
    }
}

                
OUTPUT

123
456

                    
CODE

using System;

class Jagged
{
    static void Main()
    {
        int[][] arr = new int[5][];

        arr[0] = new int[] { 1, 2, 3 };
        arr[1] = new int[] { 4, 5, 6 };
        arr[2] = new int[] { 7, 8, 9 };
        arr[3] = new int[] { 10, 11, 12 };
        arr[4] = new int[] { 13, 14, 15 };

        for (int i = 0; i < arr.Length; i++)
        {
            for(int j = 0; j < arr[i].Length; j++)
            {
                Console.Write(arr[i][j]+" ");
            }
            Console.WriteLine();
        }
    }
}
                
OUTPUT

1 2 3 
4 5 6 
7 8 9 
10 11 12 
13 14 15 
                    
CODE

using System;

class VowelsConsonantsCount
{
    static void Main()
    {
        char[] a = { 'a' , 'e' , 'i' , 'o' , 'u' };
        int Vcount = 0 , Ccount = 0;

        Console.Write("Enter String : ");
        string n = Console.ReadLine();

        for (int i = 0; i < n.Length; i++)
        {
            for (int j = 0; j < a.Length; j++)
            {
                if (n[i] == a[j])
                {
                    Vcount++;
                    break;
                }
                else
                {
                    Ccount = n.Length - Vcount;
                }
            }
        }

        //Ccount = n.Length - Vcount;

        Console.WriteLine("Vowels = "+Vcount);
        Console.WriteLine("Consonants = "+Ccount);

    }
}
                
OUTPUT

Enter String : Microsoft
Vowels = 3
Consonants = 6

                    
CODE

using System;

class ReverseString
{
    static void Main()
    {
        Console.Write("Enter String : ");
        string n = Console.ReadLine();

        for (int i = n.Length - 1 ; i > -1; i--)
        {
            Console.Write(n[i]);
        }
    }
}
                
OUTPUT

Enter String : Reverse
esreveR
                    
GOHEL MANTHAN - January 29, 2026
‹
›
Home

Creating innovative solutions for a connected world.

Email On

manthangohel04@gmail.com

This website was designed , developed and maintenance by GOHEL MANTHAN © 2026