Wednesday, January 26, 2011

Whooooooopppieee

So, you might have noticed that my last post was incomplete. It suddenly stuck my mind about a simple code that can give me the result. I decided to write it down, but then it was a stream of codes flowing like a torrent in my brain, so I just opened the Turbo C++ interface, and started typing. I was stuck at a place about what to write next, but not for more than 3 seconds. So, I finally have the code right here, and I'll share it with you! If any of my class mate who opted for computers saw this post, he'd get the benefit of a simple code. But I still do not know if my teacher would allow this code, 'cause it's not the way the multiplication table was taught to us. But anyway, I'm okay with it 'cause it actually works. So, here is the code:
#include
#include
void main()
{
int a,b,c,d,e,f,g,h,i,j,num;
clrscr();
printf("Enter the number: ");
scanf("%d",&num);
a=num*1;
b=num*2;
c=num*3;
d=num*4;
e=num*5;
f=num*6;
g=num*7;
h=num*8;
i=num*9;
j=num*10;
printf("\n%d X 1 = %d",num,a);
printf("\n%d X 2 = %d",num,b);
printf("\n%d X 3 = %d",num,c);
printf("\n%d X 4 = %d",num,d);
printf("\n%d X 5 = %d",num,e);
printf("\n%d X 6 = %d",num,f);
printf("\n%d X 7 = %d",num,g);
printf("\n%d X 8 = %d",num,h);
printf("\n%d X 9 = %d",num,i);
printf("\n%d X 10 = %d",num,j);
getch();
}

No comments:

Post a Comment