/*
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/
#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h
#include(conio.h)
int main( )
{
int r, c, num=1 ,len;
clrscr( );
printf("Enter the required no. of rows:");
scanf("%d", &len);
for( r=1; r< =len; r++ ) {
printf("\n");
for(c=1 ; c<=r; c++) {
printf("%2d", num);
num++; }
}
getch( );
return 0;
}
Explanation:-
Here 'r' indicates row,
'c' indicates column and 'len' indicates length of the pyramid.
And lastly 'num=1' for generating pyramid of numbers.
This 'c<=r' is required becoz when row is incremented, column value is also incremented.
Note:- If U have any doubts regarding this program, contact with me through my email-id.
Thursday, February 5, 2009
Subscribe to:
Post Comments (Atom)
how to write a c program to generate pyramid in the form
ReplyDelete1
2 3 2
3 4 5 4 3
#include
Deleteint main()
{
int r,s,st,n,m=1;
int nst=n;
printf("Enter size");
scanf("%d",&n);
for(r=1;r<=n;r++)
{
for(s=1;s<=n-r;s++)
{
printf("");
}
for(st=1;st<=2*r-1;st++)
{
printf("%d",m++);
printf(" ");
}
printf("\n");
}
}
mr.mujahid islam:
Deleteyour code in above has an error. My suggestion is to dry run it and rectify your error.
its in the 3rd for loop....
******
ReplyDelete*****
****
***
**
*
what the logik is set on this type of question
#include
Deleteint main()
{
int r,s,st,n;
int nst=n;
printf("Enter size");
scanf("%d",&n);
for(r=n;r>0;r--)
{
for(s=n-r;s>0;s--)
{
printf("");
}
for(st=r;st>0;st--)
{
printf("*");
printf(" ");
}
printf("\n");
}
}
i
ReplyDeletei i
i i i
i i i i
what the logik is set on this type of question
include
Deleteinclude
void main()
{
int m,n,p;
printf("enter number");
scanf("%d",&n);
for(m=1;m<=n;m++);
{
for(P=1;p<=m;p++)
print("i");
printf("\n");
}
getch();
}
what is the logic for this type?
ReplyDelete1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
#include
Deleteint main()
{
int r,s,st,n;
int nst=n;
printf("Enter size");
scanf("%d",&n);
for(r=1;r<=n;r++)
{
for(s=1;s<=n-r;s++)
{
printf("");
}
for(st=1;st<=r;st++)
{
printf("%d",r);
printf(" ");
}
printf("\n");
}
}
int main()
Delete{
int n,i,j;
printf("Enter size");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d\t",i);
}
printf("\n");
}
}
Logic behind febonacci series
Delete1
ReplyDelete1 1
1 2 1
1 3 3 1
how to write a c program to get a pyramid like this????????
#include
Deletelong peramir(int);
int main()
{
int n,i,c;
printf("Enter peramie size");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(c=0;c<=(n-i-2);c++)
printf("");
for(c=0;c<=i;c++){
printf("%ld",peramir(i)/(peramir(c)*peramir(i-c)));
printf(" ");
}
printf("\n");
}
}
long peramir(int n)
{
int c;
long f=1;
for(c=1;c<=n;c++)
f=f*c;
return f;
}
how to write a c program for this
ReplyDelete1
222
33333
4444444
555555555
#include
Deleteint main()
{
int r,s,st,n,m=1;
int nst=n;
printf("Enter size");
scanf("%d",&n);
for(r=1;r<=n;r++)
{
for(s=1;s<=n-r;s++)
{
printf("");
}
for(st=1;st<=2*r-1;st++)
{
printf("%d",r);
printf(" ");
}
printf("\n");
}
}
#include
Deleteint main()
{
int i,j,n;
printf("enter the no. of rows");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf('\n");
for(j=1;j<=((i^2)-((i-1)^2));j++)
{
printf("%d",i);
}
}
}
how to write a program like
ReplyDelete------1
-----222
----33333
---4444444
--555555555 -indicates space
01010
ReplyDelete1010
101
01
I have to do a pyramid that depending on the number that the user gives, will display the lines of a pyramid that correspond:
ReplyDeleteThe pyramid has to look like this:
1
232
34543
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
0123456789876543210
So if the user gives a number 3 the display will be:
1
323
34543
How do I do it?
My e-mail is jlblue05@hotmail.com
Please help me, thank YOU!
#include
Deletemain()
{
int n, c, d, num = 1, space;
scanf("%d",&n);
space = n - 1;
for ( d = 1 ; d <= n ; d++ )
{
num = d;
for ( c = 1 ; c <= space ; c++ )
printf(" ");
space--;
for ( c = 1 ; c <= d ; c++ )
{
printf("%d", num);
num++;
}
num--;
num--;
for ( c = 1 ; c < d ; c++)
{
printf("%d", num);
num--;
}
printf("\n");
}
return 0;
}
1
ReplyDelete121
12321
1234321
how will i get this
How to get this in generic format:
ReplyDelete------*
-----*-*
----*-*-*
---*-*-*-*
--*-*-*-*-*
-*-*-*-*-*-*
*-*-*-*-*-*-*
ignore the "-"
int a = 7;
Deletefor (int ii = 1; ii <= 7; ii++)
{
for (int j = 1; j <= ii; j++)
{
for (int k = 1; k < a; k++)
{
Console.Write(" ");
if (j > 1)
{
break;
}
}
Console.Write("*");
if (ii == 7)
{
Console.Write(" ");
}
}
Console.WriteLine();
a--;
}
Console.ReadLine();
hey thnx yaar i also have same doubt ..thnx for helping
Delete#include
Deleteint main()
{
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=n;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
printf("* ");
printf("\n");
}
return 0;
}
how to write programm
ReplyDeleteABCDEFGFEDCBA
ABCDE EDCBA
ABCD DCBA
ABC CBA
AB BA
A A
write a code for this program
Deletehow to generate the following "pyramid" of digits,using nested loops in C++.....i really need your help...........
ReplyDelete1
232
34545
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
0123456789876543210
oh i forgot...." DO NOT WRITE OUT 10 MULTI-DIGIT STRINGS. INSTEAD,DEVELOP A FORMULA TO GENERATE THE APPROPRIATE OUTPUT FOR EACH LINE. "
ReplyDeleteTHANKS FOR THE HELP...........
how to generate the following output in C.
ReplyDelete*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
#include
Deleteusing namespace std;
int main()
{
int i,j,n,m;
cout<<"Enter pyramid size\n";
cin>>n;
for(m=0;m<2;m++)
{
if(m==0){
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
cout<<"";
for(j=1;j<=i;j++)
cout<<"*";
cout<<"\n";
}
}
if(m==1){
for(i=n;i>0;i--)
{
for(j=n-i;j>0;j--)
cout<<"";
for(j=i;j>0;j--)
cout<<"*";
cout<<"\n";
}
}
}
}
how wil get this in centre instead of linear aligned in c language
ReplyDelete1
121
12321
1234321
instead in
1
121
12321
1234321
123454321
#include
Deleteint main()
{
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
for(k=i-1;k>=1;k--)
printf("%d",k);
printf("\n");
}
return 0;
}
1
ReplyDelete01
101
0101
10101
how to write program
@autoreleasepool {
Delete// insert code here...
// NSLog(@"Hello, World!");
int i,j,n,num;
NSLog(@"enter the number:=");
scanf("%d",&n);
for (i=1;i<=n;i++)
{
printf("\n" );
for(j=1;j<=i;j++)
{
if ((i%2)==0)
{
num=(j%2==0)?1:0;
printf("%d",num);
/*if ((j%2)==0)
{
num=1;
printf("%d",num);
}
else
{
num=0;
printf("%d",num);
}*/
}
else
{
num=(j%2==0)?0:1;
printf("%d",num);
/*if((j%2)==1)
{
num=1;
printf("%d",num);
}
else
{
num=0;
printf("%d",num);
}*/
}
}
}
}
return 0;
}
//
//1
///01
//101
//0101
//10101
using System;
Deleteclass BinTri
{
public static void Main()
{
int i,j,c;
c=0;
for(i=1;i<=5;i++)
{
c=i;
for(j=1;j<=i;j++)
{
if((c%2)==0)
{
Console.Write(0+" ");
}
else
{
Console.Write(1+" ");
}
c++;
}
Console.WriteLine();
}
}
}
how to write the program for
ReplyDelete1
2 3
4 5 6
7 8 9 10
#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h
Delete#include(conio.h)
int main( )
{
int r, c, num=1 ,len;
clrscr( );
printf("Enter the required no. of rows:");
scanf("%d", &len);
for( r=1; r< =len; r++ ) {
printf("\n");
for(c=1 ; c<=r; c++) {
printf("%2d", num);
num++; }
}
getch( );
}
This comment has been removed by the author.
ReplyDeleteA
ReplyDeleteB*B
C * C
D*****D
C * C
B*B
A
HOW TO WRITE THIS PROGRAM???
hi darling plz visit www.dobariya.com
DeleteHow to print this?
ReplyDelete123454321
1234 4321
123 321
12 21
1 1
1
ReplyDelete1 2
1 2 3
1 2 3 4
1 2 3 4 5
please display the solution of this program
Delete#include
Delete#include
void main()
{
int i,j;
clrscr();
for(i=0;i<6;i++)
{
printf("\n\n");
for(j=1;j<=i;j++)
printf("%d",j);
}
getch();
}
what is solution of this program ?
ReplyDeletea
2 1
b c a
4 3 2 1
what is the solution for
ReplyDelete123454321
2345432
34543
454
5
*******
ReplyDelete*****
***
*
how to get this format in C/C++ please give specific code
#include
Delete#include
void main()
{
int i,j,n=4;
clrscr();
for(i=1;i<=n;i++)
{
for(j=7;j>=(2*i-1);j--)
{
printf("*");
}
printf("\n");
}
getch();
}
1
ReplyDelete2 2
3 3 3
4 4 4 4
5 5 5 5 5 logic is
void main()
{int n=1,num;
clrscr();
printf("enter a number of row u want a peramid\n ");
scanf("%d",&num);
for(int i=1;i<=num;i++)
{for(int j=1;j<=i;j++)
{ printf("%d",n);
}
printf("\n");n++;
}
getch();
}
contact me is any other query on madke.kiran@gmail.com
program for a pyramid has to look like this:
ReplyDelete1
232
34543
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
ans:
main()
{
int r,c,num=1,len,i;
printf("enter length");
scanf("%d",&len);
for(r=1;r<=len;r++)
{
printf("\n");
for(c=1;c<=r;c++)
{
printf("%d",num);
num++;
}
num--;
i=r-1;
for(c=1;c<=i;c++)
{
num--;
printf("%d",num);
}
num++;
}
getch();
}
1=1
ReplyDelete1+2=3
1+2+3=6
1+2+3+4=10
HOW TO WRITE THIS PROGRAM?
Gausiya said
ReplyDelete------------1
---------2-----2
-------3----3-----3
----4----4----4-----4
Ans:
In java:
class Ght
{
public static void main(String args[])
{
for(int i=1;i<5;i++)
{
for(int j=i;j<5;j++)
{
System.out.print(" ");
}
for(int j=1;j<=i;j++)
{
System.out.print(" ");
System.out.print(i);
}
System.out.println(" ");
}
}
}
how to print this
ReplyDelete_______________ &
_____________ &___&
___________ &_______&
__________ & & & & & & & &
how to write this program in C?
ReplyDelete************
************
************
************
************
************
************
************
************
************
************
************
#include
Delete#include
void main()
{
int i,j,n=12;
clrscr();
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
how to write this in C?
ReplyDelete[0 space]************
[1 space]************
[2 space]************
[3 space]************
[4 space]************
[5 spaces]************
[5 spaces]************
[4 space]************
[3 space]************
[2 space]************
[1 space]************
[0 space]************
While putting a comment, it was removing the space before the pattern so i have to write it down.
How to write code for this
ReplyDelete54321
4321
321
21
1
write code for
ReplyDelete1
2 3
4 5
please help
This comment has been removed by the author.
ReplyDeletelollllllll
ReplyDeletehow to get the following pyramid?
ReplyDelete1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
please do reply fast ............if anyone knows
ReplyDeletewhat is the program for
ReplyDelete1
2 2
3 3
4 4
3 3
2 2
1
what is the program for
ReplyDelete_________1
________2_2
_______3_ _3
______4_ _ _4
_______3_ _3
________2_2
_________1
what is the program for
ReplyDeleteA
AB
ABC
ABCD
ABCDE
by using loop. iam in 11th just a beginner..!
#include
Deletemain()
{
int n,i,j,k=1,t=0;
char a[10]={' ','A','B','C','D','E','F','\n'};
printf("Enter\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=1;k<=i;k++)
{
printf("%c\t",a[k]);
}
printf("\n");
}
}
Write a program to print thre following output:
ReplyDelete*
* *
* * *
* * * *
#include
Delete#include
void main()
{
int i,j,num;
clrscr();
printf("\nenter the number of rows:");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
getch();
}
_______________*
ReplyDelete_____________*-*
___________*_*_*
_________*_*_*_*
above output to print
thanks for this!!
ReplyDelete3) Write a program to print following pyramid:
ReplyDeleteA
ABA
ABCBA
ABCDCBA
ABCBA
ABA
A
write a program to print the fallowing pyramid
ReplyDelete2
2 4
2 4 16
2 4 16 256
write a program to find the palindroms in a file and print them if the file consisting of tab as a delimiter
ReplyDeletewrite a c program for
ReplyDelete*****
****
***
**
*
i want a code for this program
ReplyDelete1 2 3 4
16 15 14 5
11 12 13 6
10 9 8 7
WAP to generate the following.
ReplyDelete0
0 1 0
0 1 2 1 0
0 1 2 3 2 1 0
how to write the program form print this..
ReplyDelete*
**
***
****
*****
pascal's triangle.
ReplyDelete#include
#include
void main()
{
int i,j,A[10][10];
clrscr();
printf("ENTER THE NUMBER OF ROWS\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(y=((y==0)!!(i==y)))
{
A[i][j];
}
}
}
else
A[i][j]=A[i-1][j-1]+A[i-1][j];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d",A[i][j]);
}
}
getch();
}
how to generate
ReplyDelete**********
****--****
***----***
**------**
*--------*
how to print this patern
ReplyDelete*
* *
* *
* *
WAP to genarate
ReplyDelete1--------1
12------21
123----321
1234--4321
1234554321
how to print
ReplyDeleteA
CBC
DDCDD
EEEDEEE
FFFFEFFFF
1
ReplyDelete11
121
1331
14641
How to write a c program to get a pyramid like this?
pls sent the programe this patern
Deletewhat is the code of this:
ReplyDelete1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
#include
Deleteint main()
{
int r,s,st,n,m;
int nst=n;
printf("Enter size");
scanf("%d",&n);
for(m=0;m<2;m++)
{
if(m==0){
for(r=1;r0;r--)
{
for(s=n-r;s>0;s--)
{
printf("");
}
for(st=r;st>0;st--)
{
printf("%d",r);
printf(" ");
}
printf("\n");
}
}
}
}
Please i want to display
Delete1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
this output.... HELP ME!!
***1
ReplyDelete**123
*12345
*1234567
123456789
how can i get this output???any1 give me the code for this????thnks
How to program that will display this:
ReplyDelete*
* * *
* * * * *
* * * * * * *
How to create a program that display this:
ReplyDelete________*
______* * *
____* * * * *
__* * * * * * *
Can Someone Help Me With This???
ReplyDelete_________________________1
______________________1__2__1
___________________1__2__4__2__1
________________1__2__4__8__4__2__1
_____________1__2__4__8__16_8__4__2__1
__________1__2__4__8__16_32_16_8__4__2__1
_______1__2__4__8_16__32_64_32_16_8__4__2__1
____1__2__4__8_16_32_64_128_64_32_16_8_4__2__1
hey Can you print this
ReplyDelete1
2 3
4 6
can you print
ReplyDelete##
###
####
#####
######
#######
########
#########
##########
using function
ReplyDelete1
2 3
4 5 6
7 8 9 1
2 3 4 5 6
if there were five rows....
how to create following:
ReplyDelete1
2 1
3 2 1
and this one too.........
ReplyDelete-----1
---2-1
3-2-1
where '-' is a space......
Program for
ReplyDelete0
101
21021
3210123
write a program to print the following?
ReplyDelete*
**
***
****
*****
----1
ReplyDelete--2-3-4
5-6-7-8-9
(- indicates spaces)
pls help to print this pattern.
#include
Deleteint main()
{
int i,j=0,k,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(k=n;k>=i;k--)
printf(" ");
for(j=j;j<=i*i;j++)
{
if(j==0)
continue;
printf(" %d ",j);
j=j;
}
printf("\n");
}
return 0;
}
#include
Deleteint main()
{
int i,j,k,n;
printf("Enter");
scanf("%d",&n);
int num=1;
for(i=1;i<=n;i=i+1)
{
for(j=3;j>i;j=j-1)
{
printf(" ");
}
for(k=num;k<=i*i;k++)
{
printf(" %d",num);
num++;
}
printf("\n");
}
}
int main()
Delete{
int i,j,n,k;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=0;j<n-i;j++)
{
printf(" ");
}
for(k=1;k<=2*i-1;k++)
{
printf("%2d",k);
}
printf("\n");
}
}
how to generate this pyramid in C -
ReplyDelete1
1 2
1 2 4
1 2 4 7
4444444
ReplyDelete4333334
4322234
4321234
4322234
4333334
4444444
Any one Solve it !
#include
Delete#include
#include
void main()
{
int arr[10][10];
int limit,col,row,r,c,val,max=0;
int width;
printf("enter the limit");
scanf("%d",&limit);
width=limit*2-1;
for(r=1;r<=width;r++)
{
for(c=1;c<=width;c++)
{
row=abs(limit-r);
col=abs(limit-c);
max=row;
if(col>row)
max=col;
val=max+1;
arr[r][c]=val;
printf("%d",arr[r][c]);
}
printf("\n");
}
}
Can anyone tell me how to print the following pyramid
ReplyDelete1
2 2
3 3 3
4 4 4 4
how to print
ReplyDelete1
2 6
3 7 10
4 8 11 13
5 9 12 14 15
hey i want to write this plz help
ReplyDelete1
12
123
1234
12345
1234
123
12
1
with for loop
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
Deletecode for below qns.............................................
Delete1
12
123
1234
12345
1234
123
12
1
...................................................................................
int main()
{
int i,j,n,k,m;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
for(k=1;k<=n;k++)
{
for(m=1;m<=n-k;m++)
{
printf("%d",m);
}
printf("\n");
}
}
what s the program to print the following..??
ReplyDelete1
1 2 1
1 2 3 2 1
#Sujita Ramanujam
DeleteCodes for following program questions............
.....................................................
1
1 2 1
1 2 3 2 1
........................................................
int main()
{
int i,j,p,k,m=0,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
p=m;
for(k=1;k<i;k++)
{
printf("%d",m--);
}
m=p+1;
printf("\n");
}
}
. Write a program to display a pyramid
ReplyDelete1
32
654
10987
This is code for below questions #Rahul Gandhi
Delete1
32
654
10987
....................................................................................
int main()
{
int i,j,n,m=2,p,k=1;
scanf("%d",&n);
for(i=0;i<n;i++)
{
p=k;
for(j=0;j<=i;j++)
{
printf("%2d",k--);
}
k=p+m;
m++;
printf("\n");
}
}
1 1
ReplyDelete12 21
123 321
1234 4321
write prog for this
1234554321
This comment has been removed by the author.
DeleteCan Someone Help Me With This???
ReplyDelete1****
12***
123**
1234*
This comment has been removed by the author.
ReplyDeleteThis is the code for above questions:#Mahmudul Hasan
ReplyDelete1****
12***
123**
1234*.............................Ans below...................................
int main()
{
int i,j,k,n;
scanf("%d",&n);
for(i=1;i<n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
for(k=1;k<=n-i;k++)
{
printf("*");
}
printf("\n");
}
}
0
ReplyDelete12
234
3456
45678
567890
67890
7890
890
90
0
please help me to solve this question.......
ReplyDelete1
ReplyDelete232
34543
4567654
i need this type of peramid in php
5 5 5 5 5
ReplyDelete5 4 4 4 4
5 4 3 3 3
5 4 3 2 2
5 4 3 2 1
I need code for pyramid
ReplyDelete__________1
_________232
________34543
_______4567654
______567898765
_____67890109876
____7890123210987
___890123454321098
__90123456765432109
_0123456789876543210
please find out the programm
ReplyDelete10000
01000
00100
00010
00001
#include
Delete#include
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=5;j++)
{
if(i-j==0)
{
printf("1");
}
else
{
printf("0");
}
}
printf("\n");
}
getch();
}
How to print
ReplyDelete1
12
234
3456
45678, etc
#include
Delete#include
void main()
{
int i,j,k=1;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(j==i)
{
printf("%d\t",k);
}
else
{
printf("%d\t",k);
k++;
}
}
printf("\n");
}
getch();
}
Write a program to print the following pattern based on user input.
ReplyDeleteFor eg: If N=4 the code should print the following pattern.
1*2*3*4*17*18*19*20
--5*6*7*14*15*16
----8*9*12*13
------10*11
Again if N=5 the code should print
1*2*3*4*5*26*27*28*29*30
--6*7*8*9*22*23*24*25
----10*11*12*19*20*21
------13*14*17*18
--------15*16
For N=2 the pattern will be
1*2*5*6
--3*4
.
I could never frame the code.Please help me.
1
ReplyDelete32
456
10987..solve this pattern
1
ReplyDelete3*2
4*5*6
10*9*8*7
even i need help
Deletewap to print
ReplyDelete12345
4321
123
21
1
Width of the shape? (Enter odd number only) 9
ReplyDeleteEnter row number to get sum 5
Answer:
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1
Sum of row 5 is 45
how to display this in c program
Was to display the following output
ReplyDelete1
4,4
9,9,9
16,16,16,16
Was to display the following output
ReplyDelete1
4,4
9,9,9
16,16,16,16
ReplyDeleteWas to display the following output
0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4
5 4 3 2 1 0 1 2 3 4 5
4 3 2 1 0 1 2 3 4
3 2 1 0 1 2 3
2 1 0 1 2
1 0 1
0
can anybody suggest code for this pattern
ReplyDelete1
3 2
6 5 4
.
.
.
.
.
.
7 8 9 10
ReplyDelete4 5 6
2 3
1
1
ReplyDelete1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
Display Pascal’s Triangle until a given row. For instance, if a user selects row = 6, the pascal triangle for
the choice would be something like below:
any one right this program??