SlideShare a Scribd company logo
1 of 8
Download to read offline
Generated by Foxit PDF Creator © Foxit Software
                                        http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


                        PATTERN PRINTING PROGRAMS

1.

1
23
456
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55

using System;

namespace Pattern1
{
    class Program
    {
        static void Main()
        {
            int num = 1;
            int i, j;
            for (i = 1; num <= 55; i++)
            {
                for (j = 1; j <= i; j++)
                {
                    Console.Write(num.ToString() + " ");
                    num++;
                }
                Console.Write("n");
            }
            Console.ReadLine();
        }
    }
}




                                                                          Page 1 of 8
Generated by Foxit PDF Creator © Foxit Software
                                          http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


2.

//   Program   to print the following output:
//   0         1       0       1       0
//   1         0       1       0       1
//   0         1       0       1       0
//   1         0       1       0       1
//   0         1       0       1       0


//   Logic:
//   Consider first row as r = 0 and first col as c = 0.
//   From output, we observe that whenever r + c is an even no,
//   we display a 0 and whenever r + c is odd we display a 1.

using System;

namespace Pattern2
{
    class Program
    {
        static void Main()
        {
            int[,] x = new int[5, 5];

                for (int r = 0; r <    5; r++)
                {
                    for (int c = 0;    c < 5; c++)
                    {
                        if ((r + c)    % 2 == 0)
                             x[r, c]   = 0;
                        else
                             x[r, c]   = 1;
                    }
                }

                for (int r = 0; r < 5; r++)
                {
                    for (int c = 0; c < 5; c++)
                    {
                        Console.Write("{0}t", x[r, c]);
                    }
                    Console.WriteLine();
                }
                Console.ReadLine();
         }
     }
}




                                                                            Page 2 of 8
Generated by Foxit PDF Creator © Foxit Software
                                         http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


3.

I/p:
Enter no. of rows
8

O/p:

1
0      1
1      0   1
0      1   0    1
1      0   1    0    1
0      1   0    1    0   1
1      0   1    0    1   0    1
0      1   0    1    0   1    0    1

using System;

namespace Pattern6
{
    class Program
    {
        public static void Main()
        {
            int h;   // height of triangle

               Console.WriteLine("Enter no. of rows ");
               h = int.Parse(Console.ReadLine());

               Console.WriteLine("1");

               for (int r = 1; r < h; r++)
               {
                   for(int c = 0; c <= r; c++)
                   {
                       if((r + c) % 2 == 0)
                            Console.Write("1t");
                       else
                            Console.Write("0t");
                   }
                   Console.WriteLine();
               }
               Console.ReadLine();
           }
       }
}




                                                                           Page 3 of 8
Generated by Foxit PDF Creator © Foxit Software
                                        http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


4.

Enter no. of rows
8

0    1    0     1   0    1    0    1
1    0    1     0   1    0    1
0    1    0     1   0    1
1    0    1     0   1
0    1    0     1
1    0    1
0    1
1

using System;

namespace Pattern7
{
    class Program
    {
        public static void Main()
        {
            int h;   // height of triangle

              Console.WriteLine("Enter no. of rows ");
              h = int.Parse(Console.ReadLine());

              for (int r = h; r >= 1; r--)
              {
                  for (int c = 1; c <= r; c++)
                  {
                      if ((r + c) % 2 == 0)
                           Console.Write("1t");
                      else
                           Console.Write("0t");
                  }
                  Console.WriteLine();
              }
              Console.ReadLine();
         }
     }
}




                                                                          Page 4 of 8
Generated by Foxit PDF Creator © Foxit Software
                                        http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


5.


1
22
333
4444
55555


using System;

namespace Pattern100
{
    class Program
    {
        static void Main()
        {
            for (int r = 1; r <= 5; r++)
            {
                Console.WriteLine(" ");
                if (r >= 10)
                     break;

                 for (int c = 1; c <= 5; c++)
                 {
                     // Console.Write(" * ");
                     Console.Write(r);
                     if (c == r)
                         goto loop1;
                 }
                 loop1: continue;
             }
             Console.ReadLine();
         }
     }
}




                                                                          Page 5 of 8
Generated by Foxit PDF Creator © Foxit Software
                                        http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


6.

//To print the   pattern:
// 1   2   3     4
// 5   6   7     8
// 9   10 11     12


using System;

namespace Arrays4
{
    class TwoD
    {
        public static void Main()
        {
            int r, c;
            int[,] x = new int[3, 4];
            for (r = 0; r < 3; ++r)
            {
                for (c = 0; c < 4; ++c)
                {
                    x[r, c] = (r * 4) + c + 1;
                    Console.Write(x[r, c] + "          ");
                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }
}




                                                                          Page 6 of 8
Generated by Foxit PDF Creator © Foxit Software
                                         http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


7. Bubble sort of a numeric array
Org list
12    -20 1        -32 65 -44 11        370    9    19
Sorted list
-44 -32 -20 1           9      11 12    19    65   370

using System;

namespace BubbleSort
{
    class Program
    {
        static void Main()
        {
            int[] a = {12, -20, 1, -32, 65, -44, 11, 370, 9, 19};

             int temp;
             int ind = 0;
             int n = a.Length;

             //display the original     list
             Console.WriteLine("Org     list");
             for (int i = 0; i < n;     i++)
             {
                 Console.Write(a[i]     + "t");
             }

             // now sort
             do
             {
                 ind = 0;
                 for (int i = 0; i < n-1; i++)
                 {
                     if (a[i] > a[i + 1])
                     {
                          temp = a[i];
                          a[i] = a[i + 1];
                          a[i + 1] = temp;
                          ind = 1; // since swapping has taken ind = 1
                     }
                 }
             } while (ind != 0);

             //display the sorted list
             Console.WriteLine("Sorted list");
             for (int i = 0; i < n; i++)
             {
                 Console.Write(a[i] + "t");
             }
             Console.ReadLine();
         }
    }
}




                                                                           Page 7 of 8
Generated by Foxit PDF Creator © Foxit Software
                                           http://www.foxitsoftware.com For evaluation only.




Prof. Mukesh N Tekwani (9869 488 356)


8. Exception – from question paper. WAP to display an error msg if name entered is
consisting of more than 15 characters

Please enter a name
Mumbai, Maharashtra
Name entered is too long

using System;

namespace ThrowingExceptions
{
    class StringTooLong : Exception { }

    class MyCheck
    {
        static public string chkinput(string x)
        {
            if (x.Length > 15)
                throw (new StringTooLong());

              return (x);
         }
    }

    class Program
    {
        static void Main()
        {
            string name;

              try
              {
                    Console.WriteLine("Please enter a name ");
                    name = Console.ReadLine();

                    MyCheck.chkinput(name);

                    Console.WriteLine("Program ends here");
                    Console.ReadLine();
              }
              catch (StringTooLong)
              {
                  Console.WriteLine("Name entered is too long");
                  Console.ReadLine();

              }
         }
    }
}




                                                                             Page 8 of 8

More Related Content

What's hot

High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14Matthieu Garrigues
 
Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)Sumant Tambe
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4Abed Bukhari
 
DSU C&C++ Practical File Diploma
DSU C&C++ Practical File DiplomaDSU C&C++ Practical File Diploma
DSU C&C++ Practical File Diplomamustkeem khan
 
Java_practical_handbook
Java_practical_handbookJava_practical_handbook
Java_practical_handbookManusha Dilan
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Nishan Barot
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...GeeksLab Odessa
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL fileRACHIT_GUPTA
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015NAVER / MusicPlatform
 
CBSE Computer Project for Class 12 ( C++)
CBSE Computer Project for Class 12 ( C++)CBSE Computer Project for Class 12 ( C++)
CBSE Computer Project for Class 12 ( C++)Karan Bora
 
Java simple programs
Java simple programsJava simple programs
Java simple programsVEERA RAGAVAN
 
Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manualSyed Mustafa
 

What's hot (19)

.net progrmming part2
.net progrmming part2.net progrmming part2
.net progrmming part2
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
C++ file
C++ fileC++ file
C++ file
 
Java practical
Java practicalJava practical
Java practical
 
39927902 c-labmanual
39927902 c-labmanual39927902 c-labmanual
39927902 c-labmanual
 
DSU C&C++ Practical File Diploma
DSU C&C++ Practical File DiplomaDSU C&C++ Practical File Diploma
DSU C&C++ Practical File Diploma
 
Java_practical_handbook
Java_practical_handbookJava_practical_handbook
Java_practical_handbook
 
delegates
delegatesdelegates
delegates
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL file
 
Dotnet 18
Dotnet 18Dotnet 18
Dotnet 18
 
C programs
C programsC programs
C programs
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
 
CBSE Computer Project for Class 12 ( C++)
CBSE Computer Project for Class 12 ( C++)CBSE Computer Project for Class 12 ( C++)
CBSE Computer Project for Class 12 ( C++)
 
Java simple programs
Java simple programsJava simple programs
Java simple programs
 
Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manual
 

Viewers also liked

Computer basics Intro
Computer basics IntroComputer basics Intro
Computer basics IntroJafar Nesargi
 
брифы и мифы
брифы и мифыбрифы и мифы
брифы и мифыRed Keds
 
Fallisia ilhamnia 09 xtkj2
Fallisia ilhamnia 09 xtkj2Fallisia ilhamnia 09 xtkj2
Fallisia ilhamnia 09 xtkj2fallisia15
 
Україна в полум'ї війни
Україна в полум'ї війниУкраїна в полум'ї війни
Україна в полум'ї війниzntulib
 
Evolucion del logo de los productos de marca
Evolucion del logo de los productos de marcaEvolucion del logo de los productos de marca
Evolucion del logo de los productos de marcalorena sanabria
 
ころりんベイビークラス
ころりんベイビークラスころりんベイビークラス
ころりんベイビークラスYuka Motobe
 
LTG Mary Legere: Tips to Become an Effective Mentor
LTG Mary Legere: Tips to Become an Effective MentorLTG Mary Legere: Tips to Become an Effective Mentor
LTG Mary Legere: Tips to Become an Effective MentorLtg Mary Legere
 
เฉลยสถาบันหลักของชาติ M.5
เฉลยสถาบันหลักของชาติ M.5เฉลยสถาบันหลักของชาติ M.5
เฉลยสถาบันหลักของชาติ M.5Kunnai- เบ้
 
Engagement with the Indian Community in Logan
Engagement with the Indian Community in Logan Engagement with the Indian Community in Logan
Engagement with the Indian Community in Logan regionalpartnerships
 
Copyof resume navdeep-latest
Copyof resume navdeep-latestCopyof resume navdeep-latest
Copyof resume navdeep-latestNavdeep Singh
 
De guias ppodddddddd
De guias ppoddddddddDe guias ppodddddddd
De guias ppoddddddddjgfhyrfd
 

Viewers also liked (15)

Computer basics Intro
Computer basics IntroComputer basics Intro
Computer basics Intro
 
Executive newswire 14
Executive newswire 14Executive newswire 14
Executive newswire 14
 
брифы и мифы
брифы и мифыбрифы и мифы
брифы и мифы
 
Fallisia ilhamnia 09 xtkj2
Fallisia ilhamnia 09 xtkj2Fallisia ilhamnia 09 xtkj2
Fallisia ilhamnia 09 xtkj2
 
Україна в полум'ї війни
Україна в полум'ї війниУкраїна в полум'ї війни
Україна в полум'ї війни
 
Evolucion del logo de los productos de marca
Evolucion del logo de los productos de marcaEvolucion del logo de los productos de marca
Evolucion del logo de los productos de marca
 
Sanjay Kedia
Sanjay KediaSanjay Kedia
Sanjay Kedia
 
ころりんベイビークラス
ころりんベイビークラスころりんベイビークラス
ころりんベイビークラス
 
LTG Mary Legere: Tips to Become an Effective Mentor
LTG Mary Legere: Tips to Become an Effective MentorLTG Mary Legere: Tips to Become an Effective Mentor
LTG Mary Legere: Tips to Become an Effective Mentor
 
Taller gbi lunes segundo corte
Taller gbi lunes segundo corteTaller gbi lunes segundo corte
Taller gbi lunes segundo corte
 
เฉลยสถาบันหลักของชาติ M.5
เฉลยสถาบันหลักของชาติ M.5เฉลยสถาบันหลักของชาติ M.5
เฉลยสถาบันหลักของชาติ M.5
 
Engagement with the Indian Community in Logan
Engagement with the Indian Community in Logan Engagement with the Indian Community in Logan
Engagement with the Indian Community in Logan
 
Copyof resume navdeep-latest
Copyof resume navdeep-latestCopyof resume navdeep-latest
Copyof resume navdeep-latest
 
De guias ppodddddddd
De guias ppoddddddddDe guias ppodddddddd
De guias ppodddddddd
 
The Film Industry
The Film IndustryThe Film Industry
The Film Industry
 

Similar to Pattern printing programs

Java parallel programming made simple
Java parallel programming made simpleJava parallel programming made simple
Java parallel programming made simpleAteji Px
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in cgkgaur1987
 
Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Jaydip JK
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperDeepak Singh
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical fileAnkit Dixit
 
Class 16: Making Loops
Class 16: Making LoopsClass 16: Making Loops
Class 16: Making LoopsDavid Evans
 
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo FinochiettiRoslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti.NET Conf UY
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and OperatorsSunil OS
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CSteffen Wenz
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...Phil Calçado
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Deepak Singh
 
C Sharp Jn (3)
C Sharp Jn (3)C Sharp Jn (3)
C Sharp Jn (3)jahanullah
 

Similar to Pattern printing programs (20)

Java parallel programming made simple
Java parallel programming made simpleJava parallel programming made simple
Java parallel programming made simple
 
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
 
C#.net
C#.netC#.net
C#.net
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)Pattern printing-in-c(Jaydip Kikani)
Pattern printing-in-c(Jaydip Kikani)
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
srgoc
srgocsrgoc
srgoc
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
 
Class 16: Making Loops
Class 16: Making LoopsClass 16: Making Loops
Class 16: Making Loops
 
pattern-printing-in-c.pdf
pattern-printing-in-c.pdfpattern-printing-in-c.pdf
pattern-printing-in-c.pdf
 
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo FinochiettiRoslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
Roslyn: el futuro de C# y VB.NET by Rodolfo Finochietti
 
Roslyn: el futuro de C#
Roslyn: el futuro de C#Roslyn: el futuro de C#
Roslyn: el futuro de C#
 
39927902 c-labmanual
39927902 c-labmanual39927902 c-labmanual
39927902 c-labmanual
 
C# Variables and Operators
C# Variables and OperatorsC# Variables and Operators
C# Variables and Operators
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009Cbse question-paper-computer-science-2009
Cbse question-paper-computer-science-2009
 
C Sharp Jn (3)
C Sharp Jn (3)C Sharp Jn (3)
C Sharp Jn (3)
 

More from Mukesh Tekwani

Computer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube ChannelComputer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube ChannelMukesh Tekwani
 
The Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdfThe Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdfMukesh Tekwani
 
ISCE-Class 12-Question Bank - Electrostatics - Physics
ISCE-Class 12-Question Bank - Electrostatics  -  PhysicsISCE-Class 12-Question Bank - Electrostatics  -  Physics
ISCE-Class 12-Question Bank - Electrostatics - PhysicsMukesh Tekwani
 
Hexadecimal to binary conversion
Hexadecimal to binary conversion Hexadecimal to binary conversion
Hexadecimal to binary conversion Mukesh Tekwani
 
Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Mukesh Tekwani
 
Hexadecimal to octal conversion
Hexadecimal to octal conversionHexadecimal to octal conversion
Hexadecimal to octal conversionMukesh Tekwani
 
Gray code to binary conversion
Gray code to binary conversion Gray code to binary conversion
Gray code to binary conversion Mukesh Tekwani
 
Decimal to Binary conversion
Decimal to Binary conversionDecimal to Binary conversion
Decimal to Binary conversionMukesh Tekwani
 
Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Mukesh Tekwani
 
Refraction and dispersion of light through a prism
Refraction and dispersion of light through a prismRefraction and dispersion of light through a prism
Refraction and dispersion of light through a prismMukesh Tekwani
 
Refraction of light at a plane surface
Refraction of light at a plane surfaceRefraction of light at a plane surface
Refraction of light at a plane surfaceMukesh Tekwani
 
Atom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomAtom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomMukesh Tekwani
 
Refraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesRefraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesMukesh Tekwani
 
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEMukesh Tekwani
 

More from Mukesh Tekwani (20)

Computer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube ChannelComputer Science Made Easy - Youtube Channel
Computer Science Made Easy - Youtube Channel
 
The Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdfThe Elphinstonian 1988-College Building Centenary Number (2).pdf
The Elphinstonian 1988-College Building Centenary Number (2).pdf
 
Circular motion
Circular motionCircular motion
Circular motion
 
Gravitation
GravitationGravitation
Gravitation
 
ISCE-Class 12-Question Bank - Electrostatics - Physics
ISCE-Class 12-Question Bank - Electrostatics  -  PhysicsISCE-Class 12-Question Bank - Electrostatics  -  Physics
ISCE-Class 12-Question Bank - Electrostatics - Physics
 
Hexadecimal to binary conversion
Hexadecimal to binary conversion Hexadecimal to binary conversion
Hexadecimal to binary conversion
 
Hexadecimal to decimal conversion
Hexadecimal to decimal conversion Hexadecimal to decimal conversion
Hexadecimal to decimal conversion
 
Hexadecimal to octal conversion
Hexadecimal to octal conversionHexadecimal to octal conversion
Hexadecimal to octal conversion
 
Gray code to binary conversion
Gray code to binary conversion Gray code to binary conversion
Gray code to binary conversion
 
What is Gray Code?
What is Gray Code? What is Gray Code?
What is Gray Code?
 
Decimal to Binary conversion
Decimal to Binary conversionDecimal to Binary conversion
Decimal to Binary conversion
 
Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21Video Lectures for IGCSE Physics 2020-21
Video Lectures for IGCSE Physics 2020-21
 
Refraction and dispersion of light through a prism
Refraction and dispersion of light through a prismRefraction and dispersion of light through a prism
Refraction and dispersion of light through a prism
 
Refraction of light at a plane surface
Refraction of light at a plane surfaceRefraction of light at a plane surface
Refraction of light at a plane surface
 
Spherical mirrors
Spherical mirrorsSpherical mirrors
Spherical mirrors
 
Atom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atomAtom, origin of spectra Bohr's theory of hydrogen atom
Atom, origin of spectra Bohr's theory of hydrogen atom
 
Refraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lensesRefraction of light at spherical surfaces of lenses
Refraction of light at spherical surfaces of lenses
 
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGEISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
 
Cyber Laws
Cyber LawsCyber Laws
Cyber Laws
 
XML
XMLXML
XML
 

Recently uploaded

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Recently uploaded (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Pattern printing programs

  • 1. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) PATTERN PRINTING PROGRAMS 1. 1 23 456 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 using System; namespace Pattern1 { class Program { static void Main() { int num = 1; int i, j; for (i = 1; num <= 55; i++) { for (j = 1; j <= i; j++) { Console.Write(num.ToString() + " "); num++; } Console.Write("n"); } Console.ReadLine(); } } } Page 1 of 8
  • 2. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 2. // Program to print the following output: // 0 1 0 1 0 // 1 0 1 0 1 // 0 1 0 1 0 // 1 0 1 0 1 // 0 1 0 1 0 // Logic: // Consider first row as r = 0 and first col as c = 0. // From output, we observe that whenever r + c is an even no, // we display a 0 and whenever r + c is odd we display a 1. using System; namespace Pattern2 { class Program { static void Main() { int[,] x = new int[5, 5]; for (int r = 0; r < 5; r++) { for (int c = 0; c < 5; c++) { if ((r + c) % 2 == 0) x[r, c] = 0; else x[r, c] = 1; } } for (int r = 0; r < 5; r++) { for (int c = 0; c < 5; c++) { Console.Write("{0}t", x[r, c]); } Console.WriteLine(); } Console.ReadLine(); } } } Page 2 of 8
  • 3. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 3. I/p: Enter no. of rows 8 O/p: 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 using System; namespace Pattern6 { class Program { public static void Main() { int h; // height of triangle Console.WriteLine("Enter no. of rows "); h = int.Parse(Console.ReadLine()); Console.WriteLine("1"); for (int r = 1; r < h; r++) { for(int c = 0; c <= r; c++) { if((r + c) % 2 == 0) Console.Write("1t"); else Console.Write("0t"); } Console.WriteLine(); } Console.ReadLine(); } } } Page 3 of 8
  • 4. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 4. Enter no. of rows 8 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 using System; namespace Pattern7 { class Program { public static void Main() { int h; // height of triangle Console.WriteLine("Enter no. of rows "); h = int.Parse(Console.ReadLine()); for (int r = h; r >= 1; r--) { for (int c = 1; c <= r; c++) { if ((r + c) % 2 == 0) Console.Write("1t"); else Console.Write("0t"); } Console.WriteLine(); } Console.ReadLine(); } } } Page 4 of 8
  • 5. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 5. 1 22 333 4444 55555 using System; namespace Pattern100 { class Program { static void Main() { for (int r = 1; r <= 5; r++) { Console.WriteLine(" "); if (r >= 10) break; for (int c = 1; c <= 5; c++) { // Console.Write(" * "); Console.Write(r); if (c == r) goto loop1; } loop1: continue; } Console.ReadLine(); } } } Page 5 of 8
  • 6. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 6. //To print the pattern: // 1 2 3 4 // 5 6 7 8 // 9 10 11 12 using System; namespace Arrays4 { class TwoD { public static void Main() { int r, c; int[,] x = new int[3, 4]; for (r = 0; r < 3; ++r) { for (c = 0; c < 4; ++c) { x[r, c] = (r * 4) + c + 1; Console.Write(x[r, c] + " "); } Console.WriteLine(); } Console.ReadLine(); } } } Page 6 of 8
  • 7. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 7. Bubble sort of a numeric array Org list 12 -20 1 -32 65 -44 11 370 9 19 Sorted list -44 -32 -20 1 9 11 12 19 65 370 using System; namespace BubbleSort { class Program { static void Main() { int[] a = {12, -20, 1, -32, 65, -44, 11, 370, 9, 19}; int temp; int ind = 0; int n = a.Length; //display the original list Console.WriteLine("Org list"); for (int i = 0; i < n; i++) { Console.Write(a[i] + "t"); } // now sort do { ind = 0; for (int i = 0; i < n-1; i++) { if (a[i] > a[i + 1]) { temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; ind = 1; // since swapping has taken ind = 1 } } } while (ind != 0); //display the sorted list Console.WriteLine("Sorted list"); for (int i = 0; i < n; i++) { Console.Write(a[i] + "t"); } Console.ReadLine(); } } } Page 7 of 8
  • 8. Generated by Foxit PDF Creator © Foxit Software http://www.foxitsoftware.com For evaluation only. Prof. Mukesh N Tekwani (9869 488 356) 8. Exception – from question paper. WAP to display an error msg if name entered is consisting of more than 15 characters Please enter a name Mumbai, Maharashtra Name entered is too long using System; namespace ThrowingExceptions { class StringTooLong : Exception { } class MyCheck { static public string chkinput(string x) { if (x.Length > 15) throw (new StringTooLong()); return (x); } } class Program { static void Main() { string name; try { Console.WriteLine("Please enter a name "); name = Console.ReadLine(); MyCheck.chkinput(name); Console.WriteLine("Program ends here"); Console.ReadLine(); } catch (StringTooLong) { Console.WriteLine("Name entered is too long"); Console.ReadLine(); } } } } Page 8 of 8