0
Sharad Sharma's Avatar
Newbie Member
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long n,j,p=0,q;
clrscr();
printf("\n Enter the number of rows : ");
scanf("%ld",&n);
for(j=0;j<=n-1;j++)
{
p=1*pow(10,j)+p;
q=p*p;
printf("%ld",q);
printf("\n");
}
getch();
}

Last edited by shabbir; 22Aug2011 at 19:39.. Reason: Code blocks
abhix95 like this
0
Sharad Sharma's Avatar
Newbie Member
1
121
12321

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long n,j,p=0,q;
clrscr();
printf("\n Enter the number of rows : ");
scanf("%ld",&n);
for(j=0;j<=n-1;j++)
{
p=1*pow(10,j)+p;
q=p*p;
printf("%ld",q);
printf("\n");
}
getch();
}
0
Sharad Sharma's Avatar
Newbie Member
(2)
1
121
12321

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
long n,j,p=0,q;
clrscr();
printf("\n Enter the number of rows : ");
scanf("%ld",&n);
for(j=0;j<=n-1;j++)
{
p=1*pow(10,j)+p;
q=p*p;
printf("%ld",q);
printf("\n");
}
getch();
}
abhix95 like this
0
abhix95's Avatar, Join Date: Jan 2012
Newbie Member
1
11
112
11235
112358

#include<iostream.h>
#include<conio.h>
void main()
{
int a, b,c,r,p=0,n=1;
clrscr();
cout<<"Enter number of line";
cin>>a;
for(b=1;b<=a;b++)
{
cout<<1<<"\t";
for(c=1;c<b;c++)
{
r=p+n;
p=n;
n=r;
cout<<r<<"\t";
}
cout<<endl;
n=1;
p=r=0;
}
getch();
}
0
cwizard's Avatar
Newbie Member
Code:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[20],n;
a[0]=1;
a[1]=1;
cout<<"Enter the limit"<<endl;
cin>>n;
for(int j=1;j<=n;j++)
 {
  for(int i=2;i<=j;i++)
  {
   a[i]=a[i-1]+a[(i-1)-1];
  }
 }
for(j=0;j<=n;j++)
 {
  for(int i=0;i<=j;i++)
  {
  cout<<a[i];
  }
 cout<<endl;
 }
getch();
}

Last edited by shabbir; 30Jul2012 at 10:32.. Reason: Code blocks
0
vijayuit's Avatar, Join Date: Aug 2012
Newbie Member
Code:
#include<stdio.h>
void main(){
int n,i,j,f1=0,f2=1,f3=0,k,a[25];
printf("ENTER THE NUMBER\n");
scanf("%d",&n);
for(i=1;i<n;i++)
{
f1=f2;
f2=f3;
f3=f2+f1;
a[i]=f3;
for(j=1;j<=i;j++)
{
printf("%d\t",a[j]);
}
printf("\n");
}
}

Last edited by shabbir; 3Aug2012 at 18:51.. Reason: Code blocks
0
vijayuit's Avatar, Join Date: Aug 2012
Newbie Member
Code:
#include<stdio.h>
void main(){
int n,i,j,k;
printf("ENTER THE NUMBER\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
printf("%d",j);
for(k=j-2;k>0;k--)
printf("%d",k);
printf("\n");
}
}

Last edited by shabbir; 3Aug2012 at 18:52.. Reason: Code blocks
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
But where are the *difficult* C programs? These 10-15 line tiddlers might be challenging for beginners for about 5 minutes, but that doesn't qualify them to be called difficult. IOCCC - now THERE are some difficult C programs!
0
manojgdhv's Avatar, Join Date: Aug 2012
Newbie Member
1)
Code:
void main()
{
int f1=1,f2=1,f3=0,n=5,i,j;
for(i=1;i<=5;i++)
{
   printf("\n%d %d ",f1,f2);
   for(j=2;j<=i;j++)
   {
    
    f3=f1+f2;
    printf("%d ",f3);
    f1=f2;
    f2=f3;
   }
}
}
 2)
void main()
{
int i=0,j=0;
for(i=1;i<=4;i++)
{
    for(j=1;j<=i;j++)
  printf("%d",j);
  for(j=i-1;j>=1;j--)
  printf("%d",j);
printf("\n");
}
}

Last edited by shabbir; 17Aug2012 at 19:25.. Reason: Code blocks
0
Kush Pandey's Avatar, Join Date: Jan 2013
Newbie Member
here is the output of program to print
11
112
1123
11235
112358


Code:
#include<stdio.h>
#include<conio.h>
 main(){
    int i,j,a=1,b=1,c;

    for(i=1;i<=5;i++)
    {
        printf("%d\t%d\t",a,b);
    for(j=3;j<=i+1;j++)
    {
        c=a+b;
        printf("%d\t",c);
        a=b;
        b=c;
    }
    a=1;b=1;
    printf("\n");
    }
}

Last edited by shabbir; 10Jan2013 at 12:01.. Reason: Code blocks