Display this kind of output on screen.
1
0 1
1 0 1
3. Display this kind of output on screen.
1
1 0
1 0 1
4. Display this kind of output on screen.
1
1 0
1 0 1
5.Display this kind of output on screen.
1
2 3
4 5 6
7 8 9 10



Display this kind of output on screen. 1 0 1 1 0 1 3. Display this kind of outpu..

Answer / vasanti

void main()
{
int i,j;
for(i=0;i<=2;i++)
{
for(j=2;j>i;j--)
printf(" ");
for(j=1;j<(i+1);j++)
{
printf("%d",mod(j-i));
}
printf("/n");
}
getch();
}

------------------------------\void main()
{
int i,j;
for(i=0;i<=2;i++)
{
// for(j=2;j>i;j--)
// printf(" ");
for(j=1;j<(i+1);j++)
{
printf("%d",mod(i-j));
}
printf("/n");
}
getch();
}
--------------------------------
void main()
{
int i,j;
for(i=0;i<=2;i++)
{
//for(j=2;j>i;j--)
// printf(" ");
for(j=1;j<(i+1);j++)
{
printf("%d",mod(j-i));
}
printf("/n");
}
getch();
}
-------------------------
void main()
{
int i,j,k=1;
for(i=0;i<=3;i++)
{
for(j=3;j>i;j--)
printf(" ");
for(j=1;j<(i+1);j++)
{
k=k+1;
printf("%d",k);
}
printf("/n");
}
getch();
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C C++ Errors Interview Questions

errors are known as?

3 Answers   EX, State Bank Of India SBI,


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.

5 Answers   CMC,


To generate the series 1+3+5+7+... using C program

18 Answers  


who was the present cheif governor of reserve bank of india

6 Answers   State Bank Of India SBI,






#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer

10 Answers   Wipro,


Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }

2 Answers  


void main() { int i=5; printf("%d",i+++++i); }

14 Answers   HCL,


wap for bubble sort

3 Answers  


Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .

3 Answers  


Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?

2 Answers  


How to upgrade LOOP environment, I just mean, how can i make loop statement editable ? I just try some program using loop statement and checking it in multiple compilers. Every compiler showing different output, what's the wrong ? is it a compiler based problem, or loop based problem, tell me why ? and what will be the debugging process, for this kind of problem ?

1 Answers  


Categories