Sunday 1 November 2015

Write a program to print the following pattern using loop in c language.

Write a program to print the following pattern using loop in c language. #include<studio.h> #include<coino.h> Void m... thumbnail 1 summary

Write a program to print the following pattern using loop in c language.


#include<studio.h>
#include<coino.h>
Void main()
{
            Int I,j,n,k,l=1,m=65;
            Printf(“Enter Your no : ”);
            Scanf(“%d”,&n);
            For(i=1;i<n;i++)
            {
                        For(j=n;j>I;j--)
                        {
                                    Printf(“  “);
                        }
                        If(i%2!=0)
                        {
                                    For(k=1;k<=I;k++)
                                    {
                                                Printf(“%d”,l);
                                                Printf(“  ”);
                                                l++;
                                    }
                        }
                        else
                        {
                                    For(k=1;k<=I;k++)
                                    {
                                                Printf(“%c”,m);
                                                Printf(“  “);
                                                m++:
                                    }
                        }
            Printf(“\n”);
}
}

Output :- 

                                                          1
                                                A                B
                                      2                 3                 4

                             C                 D                E                 F


No comments

Post a Comment