Tuesday, July 28, 2009

Turbo c help?

please help me to make a multiplication table.





the output will be like this:





1 2 3 4 5 6 7 8 9 10


2 4 6 8 10 12 14 16 18 20


3 6 9 12 15 18 21 24 27 30


4 8 12 16 20 24 28 32 36 40


5 10 15 20 25 30 35 40 45 50


6 12 18 24 30 36 42 48 54 60


7 14 21 28 35 42 49 56 63 70


8 16 24 32 40 48 56 64 72 80


9 18 27 36 45 54 63 72 81 90


10 20 30 40 50 60 70 80 90 100





for, if and while statement will do..





tnx!!!


I'll appreciate all answers as long as it make sense!!





~PLEASE DON'T ANSWER IF YOU CAN'T UNDERSTAND OR DON'T KNOW HOW TO DO IT.. THIS IS SERIOUS BUSINESS!!!~

Turbo c help?
#include%26lt;stdio.h%26gt;


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





void main()


{


int i, j;


clrscr();


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


{


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


{


printf(" %d ",,j*i);


}


printf("\n");


}


getch();


}





just copy it in ur turbo c editor and run it.
Reply:for(int i=1; i%26lt;=10; i++)


{


for(int j=1; j%26lt;=10; j++)


{


printf("%d ",j*i);


}


printf("\n");


}
Reply:Tsk, tsk. You shouldn't have other people do your homework. You should read my advice to your other question. You need to calm down.


Compile this instead:





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


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


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


time_t t;


int num;


char bah;


int main(void)


{


srand((unsigned) time(%26amp;t));


num=((1+(rand() %10)));


printf("Press ENTER to have your fortune told.\r\n");


bah = getc(stdin);


switch (num)


{


case 1:


printf("Energizer Bunny Arrested! - Charged with battery.\r\n");


break;


case 2:


printf("I'm telling the teacher that you're moonlighting.\r\n");


break;


case 3:


printf("ASCII and ye shall recieve.\r\n");


break;


case 4:


printf("Confucious Say: Chicks who take programming too seriously have their hair fall out.\r\n");


break;


case 5:


printf("Avoid criticism.......Say, do, and be NOTHING!\r\n");


break;


case 6:


printf("Back up my hard drive??? Where's the 'reverse' switch?\r\n");


break;


case 7:


printf("Your teacher does the work of 3 men (Curly, Larry, and Moe).\r\n");


break;


case 8:


printf("C:\\DOS C:\\DOS\\RUN RUN DOS RUN!\r\n");


break;


case 9:


printf("Beware of geeks bearing .gifs\r\n");


break;


case 10:


printf("If not for C, we'd be using BASI, PASAL, and OBOL!\r\n");


}


return 0;


}
Reply:#include%26lt;stdio.h%26gt;


int main(void)


{


int i=0;


int j=0;


int result;


int d=0;


int w=1;


printf("which number you choose");


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





result=d*j;


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


printf("%d*%d=%d\n", d,j,d*j);


printf("\n");


return 0;


}
Reply:#include %26lt;stdio.h%26gt;


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





int main(){





int i,j;





printf("\n\n");





for (i=1;i%26lt;11;i++){





for (j=1;j%26lt;11;j++) {


printf("%4d",i*j);


}


printf("\n\n");


}





system("pause");


return 0;


}


No comments:

Post a Comment