Monday, May 24, 2010

Need help in Turbo C in producing this outputs using for loop statements?..PLS help me!..i nd answr b4 spt 28?

Need help in Turbo C again in producing this outputs using for loop statements..?


1.First output must be like this with the use of 2 for loop and gotoxy:


54321


4321


321


21


1





2. Second is with the use of 2 for loop again:


12345


1234


123


12


1





3. Third is with the use of 2 for loop again:


12345


2


3


4


5


This my prog that i did but it not work...Pls HELP me to correct my program before September 27, 2007 Philippine time!!!!!!!





#include%26lt;stdio.h%26gt;


main()


{


int cas,cnt,ctr,x=1,y=2;


clrscr();


printf("Enter case number[1-4]:");


scanf("%d",%26amp;cas);


switch(cas)


{


case 1:


{for(cnt=5;cnt%26gt;0;cnt--,x++,y++...


{for(ctr=cnt;ctr%26gt;0;ctr--)


gotoxy(x,y);printf("%d",ctr);


printf("\n");


}


break;


}





case 2:


{ for(cnt=1;cnt%26lt;=5;cnt++)


{for(ctr=cnt;ctr%26lt;=5;ctr++)


printf("%d",cnt);


printf("\n");}


break;


}


case 3:


{for(cnt=5;cnt%26gt;0;cnt--)


{for(ctr=cnt;ctr%26lt;=5;ctr++)


printf("%d",ctr);


printf("\n");


}


break;


}


getch();


}

Need help in Turbo C in producing this outputs using for loop statements?..PLS help me!..i nd answr b4 spt 28?
#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


main()


{


int i=0,j=0,sw;


clrscr();


printf("Enter your choice: ");


scanf("%d",%26amp;sw);


switch(sw)


{


case 1:





for (i=5;i%26gt;=1;i--)


{





for(j=1;j%26lt;=i;j++)


{


printf("%d",j);





}





printf("\n");


}


break;


case 2:





for(i=5;i%26gt;=0;i--)


{


for(j=i;j%26gt;=1;j--)


{


printf("%d",j);


}


printf("\n");


}


break;


case 3:


for(i=1;i%26lt;=5;i++)


printf("%d",i);


printf("\n");


for(j=2;j%26lt;i;++j)


{


printf("%d",j);


printf("\n");


}


}


getch();


}
Reply:Do your own homework assignments. But just wait someone will come along and do it for you meaning you learn nothing and that person will help in dumbing you down even further.
Reply:People aren't here to do your homework for you. Do it yourself, or you will never learn anything.





Also, if you want people to do your work for you, the least you could do is type complete words so that people have a fighting chance of understanding you. "i nd answr b4 spt 28" doesn't mean much in English, which was presumably the language you were _trying_ to type in.

daylily

No comments:

Post a Comment