prog. to produce 1
2 3
4 5 6
7 8 9 10
Answers were Sorted based on User's Feedback
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 |
#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 |
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 |
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 |
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
2 Answers Mentor Graphics, Microsoft,
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }
Write a C function to search a number in the given list of numbers. donot use printf and scanf
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];
write a c program to print magic square of order n when n>3 and n is odd?
main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
union u { struct st { int i : 4; int j : 4; int k : 4; int l; }st; int i; }u; main() { u.i = 100; printf("%d, %d, %d",u.i, u.st.i, u.st.l); } a. 4, 4, 0 b. 0, 0, 0 c. 100, 4, 0 d. 40, 4, 0
prog. to produce 1 2 3 4 5 6 7 8 9 10