PROG. TO PRODUCE 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Answer / aadhirai r
#include<stdio.h>
#include<conio.h>
void main()
{
int j=2,n,num,b[20],a[20];
a[0]=1; a[1]=2; a[2]=1;
clrscr();
printf("Enter the no of rows");
scanf("%d",&num);
printf(" 1\n");
printf(" 1 1\n");
printf(" 1 2 1\n");
while(j<=num)
{
int i=0;
b[0]=1;
for(n=1;n<=j;n++)
{
b[n]=a[i]+a[i+1];
i++;
}
b[n]=1;
gotoxy(15-(j),j+3);
for(i=0;i<=n;i++)
{
printf("%d ",b[i]);
a[i]=b[i];
}
j++;
}
getch();
}
Is This Answer Correct ? | 4 Yes | 1 No |
struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error
main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }
write a program to Insert in a sorted list
void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
how to concatenate the two strings
void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }
How to read a directory in a C program?
create a login program that ask username and password. if you input username or password 3 times wrong, the program will terminate else the program will prompt a message "congratulations"