Number Pattern Programs in C
Posted by Nikhil Chawra 7/03/2012
Learn Number pattern program in C and generates new logics and new concept which is better for your FUture. Learn and Enjoy the new Patterns of number in C.
you can also read this :-
How To Play Sounds In C Language
Number pattern :1
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n;
clrscr();
printf("\nEneter the no of lines to be printed: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
if(j%2==0)
printf("0");
else
printf("1");
}
printf("\n");
}
getch();
}
Number pattern :2
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("\nEnter the no of lines to be printed: ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=n-i;j>0;j--)
{
printf(" "); //THIS IS THE CODE FOR PRINTING THE SPACES.
}
for(k=0;k<=i;k++)
{
if(k%2==0)
printf("0");
else
printf("1");
}
printf("\n");
}
getch();
}
Number pattern :3
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
getch();
}
Number pattern :4
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%d",k);
}
printf("\n");
}
getch();
}
Number pattern: 5
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=0;j<(n-i-1);j++)
{
printf(" ");
}
for(k=1;k<=2*i+1;k++)
{
printf("%d",k);
}
printf("\n");
}
getch();
}
Number pattern:6
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=0;j<(n-i-1);j++)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%d",k);
}
while(k>0)
{
printf("%d",k);
k--;
}
printf("\n");
}
getch();
}
Number pattern:7
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k,num=1;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<=n;i++)
{
for(j=0;j<(n-i);j++)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("%4d",num++);
}
printf("\n");
}
getch();
}
Number pattern: 8
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n"); for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
if(k%2==1)
printf("1");
else
printf("0");
k++;
}
printf("\n");
}
getch();
}
Number pattern 9
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k=1,l;
clrscr();
printf("Enter the number of lines to be printed: "); scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(l=n;l>i+1;l--)
printf(" ");
for(j=0;j<=i;j++)
{
if(k%2==1)
printf("1");
else
printf("0");
k++;
}
printf("\n");
}
getch();
}
Number pattern :10
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=n;i>0;i--)
{
for(j=0;j<n-i;j++)
{
printf(" ");
}
for(k=i;k>0;k--)
{
printf("%d",k);
}
printf("\n");
}
getch();
}
#include<stdio.h>
void main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=n;i>0;i--)
{
for(j=0;j<n-i;j++)
{
printf(" ");
}
for(k=i;k>0;k--)
{
printf("%d",k);
}
printf("\n");
}
getch();
}
Number pattern :11
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=1;i<=n;i++)
{
for(j=i;j>0;j--)
{
printf("%d ",j);
}
printf("\n");
}
getch();
}
#include<stdio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter the number of lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=1;i<=n;i++)
{
for(j=i;j>0;j--)
{
printf("%d ",j);
}
printf("\n");
}
getch();
}
Number pattern 12
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n,l;
clrscr();
printf("\nEnter the no lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=n-i;j>0;j--)
printf(" ");
for(k=i;k>0;k--)
{
printf("%d ",k);
}
for(l=2;l<=i;l++)
{
printf("%d ",l);
}
printf("\n");
}
}
#include<stdio.h>
void main()
{
int i,j,k,n,l;
clrscr();
printf("\nEnter the no lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=n-i;j>0;j--)
printf(" ");
for(k=i;k>0;k--)
{
printf("%d ",k);
}
for(l=2;l<=i;l++)
{
printf("%d ",l);
}
printf("\n");
}
}
Number pattern :13
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("Enter the number of lines to be printed ;");
scanf("%d",&n);
printf("\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%3d",(j*i));
}
printf("\n");
}
for(k=n-1;k>0;k--)
{
for(j=1;j<=k;j++)
printf("%3d",(k*j));
printf("\n");
}
getch();
}
Number pattern 14
#include<conio.h>
#include<stdio.h>
void main()
{
int i,j,k,n,l;
clrscr();
printf("\nEnter the no lines to be printed: ");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
for(j=n-i;j>0;j--)
printf(" ");
for(k=n-i;k<=n;k++)
{
printf("%d ",k);
}
for(l=n-1;l>=n-i;l--)
{
printf("%d ",l);
}
printf("\n");
}
}
IF any Problem then write in comment !
?
+
X
Recommended for you
Loading..
1 comments:
you can get some of the above codes an a lot of other programs at :::
https://www.facebook.com/ITSagarSol
*** Share with Care ***
Post a Comment