Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

2 Answers  


#include<stdio.h> int main() { int x=2,y; y=++x*x++*++x; printf("%d",y); } Output for this program is 64. can you explain how this output is come??

1 Answers  


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  






WAP to display 1,2,3,4,5........N

2 Answers  


main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


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

1 Answers  


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


Develop a routine to reflect an object about an arbitrarily selected plane

0 Answers  


main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  


Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,






Categories