prog. to produce 1
2 3
4 5 6
7 8 9 10

Answers were Sorted based on User's Feedback



prog. to produce 1 2 3 4 5 6 ..

Answer / devendra lohiya

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,sp=7;
clrscr();
for(i=1,k=1;i<5;i++)
{
for(l=1;l<sp;l++)
printf(" ");
sp-=2;
printf(" ");
for(j=1;j<=i;j++,k++)
{
printf(" ");
printf("%d",k);
printf(" ");
}
printf("\n");
}
getch();
}

Is This Answer Correct ?    2 Yes 0 No

prog. to produce 1 2 3 4 5 6 ..

Answer / sudhanshu kumar

#include<stdio.h>
#include<conio.h>

void main()
{
int nol,i,j,k=1,l=1;
clrscr();
printf("Enter the no. of line: ");
scanf("%d",&nol);
for(i=nol*2;i>=2; i=i-2)
{
printf("\n\n");
for(j=1;j<=i;j++)
printf(" ");

for(j=1;j<=l;j++)
printf("%2d ",k++);
l++;
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No

prog. to produce 1 2 3 4 5 6 ..

Answer / gaurav singh

In c++ u can write like this

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j=0,k=1,s=0;
cout<<"pattern \n";
for(i=1;i<=4;i++)
{
for(s=4-i;s>0;s--)
{
cout<<" ";
}
for(j=i;j>0;j--)
{
cout<<k;
k++;
cout<<" ";
}
cout<<"\n";
}

getch();
}

Is This Answer Correct ?    0 Yes 0 No

prog. to produce 1 2 3 4 5 6 ..

Answer / mini

#include<stdio.h>
#include<conio.h>
main()
{
int i,n;
printf("enter the number to n")
scanf(%d,\n)
i=1,i++;
i<=10;
printf("he result is \i")
getch();
}

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More C Code Interview Questions

void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); }

1 Answers  


/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

3 Answers  


#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

1 Answers   GoDB,






int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

1 Answers  


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

0 Answers  


Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above

2 Answers   HCL,


main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }

2 Answers  


main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,


main() { char a[4]="HELLO"; printf("%s",a); }

3 Answers   CSC,


Categories