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

main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

3 Answers   HCL,


void main() { char ch; for(ch=0;ch<=127;ch++) printf(ā€œ%c %d \nā€œ, ch, ch); }

1 Answers  


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

4 Answers   TCS,


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,


void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }

2 Answers  






find simple interest & compund interest

2 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


plz send me all data structure related programs

2 Answers  


How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


Categories