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

write the value of x and y after execution of the statements: int x=19,y; y=x++ + ++x; x++; y++;

0 Answers  


who was the present cheif governor of reserve bank of india

6 Answers   State Bank Of India SBI,


full c programming error question based problem

3 Answers   HCL, TCS,


what is the error in the following code: main() { int i=400,j; j=(i*i)/i; }

4 Answers  


void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....

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  


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

18 Answers  


How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis

0 Answers  


#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }

19 Answers  


A sample program using data structure? what is file handling?

0 Answers   TCS,


write a profram for selection sort whats the error in it?

2 Answers  


Write a c-programe that input one number of four digits and find digits sum?

2 Answers  


Categories