ปกติเป็นแบบนี้
2 x 1 = 2 2 x 12 = 24 ผมอยากให้สลับเป็นแบบนี้ครับ ต้องทำไงครับ
2 x 2 = 4 2 x 11 = 22
2 x 3 = 6 2 x 10 = 20
2 x 4 = 8 2 x 9 = 18
2 x 5 = 10 2 x 8 = 16
2 x 6 = 12 2 x 7 = 14
2 x 7 = 14 2 x 6 = 12
2 x 8 = 16 2 x 5 = 10
2 x 9 = 18 2 x 4 = 8
2 x 10 = 20 2 x 3 = 6
2 x 11 = 22 2 x 2 = 4
2 x 12 = 24 2 x 1 = 2
#include <stdio.h>
int main()
{
printf ("name is Thawatchai \n");
printf ("Age 18 height 169 weight 65 \n");
int nstart, nend, main, scount, loop;
int i, j, k;
int limit = 6;
printf(" Enter multiplication from : ");
scanf("%d", &nstart);
printf(" Enter multiplication to : ");
scanf("%d", &nend);
scount = (nend - nstart) + 1;
loop = (scount + limit - 1) / limit;
printf("\n\n");
for(i=0; i<loop; i++){
for(j=1; j<=12; j++){
main = nstart;
for(k=1; k<=scount && k <= limit; k++){
printf("%5dx%3d=%3d", main, j, main*j);
main++;
}
printf("\n");
}
nstart+=limit;
scount-=limit;
printf("\n\n");
}
scanf (" ");
return 0;
{
โค้ด DEV C++ ทำยังไงให้ตัวเลขสลับจากข้างล่างไปข้างบน
2 x 1 = 2 2 x 12 = 24 ผมอยากให้สลับเป็นแบบนี้ครับ ต้องทำไงครับ
2 x 2 = 4 2 x 11 = 22
2 x 3 = 6 2 x 10 = 20
2 x 4 = 8 2 x 9 = 18
2 x 5 = 10 2 x 8 = 16
2 x 6 = 12 2 x 7 = 14
2 x 7 = 14 2 x 6 = 12
2 x 8 = 16 2 x 5 = 10
2 x 9 = 18 2 x 4 = 8
2 x 10 = 20 2 x 3 = 6
2 x 11 = 22 2 x 2 = 4
2 x 12 = 24 2 x 1 = 2
#include <stdio.h>
int main()
{
printf ("name is Thawatchai \n");
printf ("Age 18 height 169 weight 65 \n");
int nstart, nend, main, scount, loop;
int i, j, k;
int limit = 6;
printf(" Enter multiplication from : ");
scanf("%d", &nstart);
printf(" Enter multiplication to : ");
scanf("%d", &nend);
scount = (nend - nstart) + 1;
loop = (scount + limit - 1) / limit;
printf("\n\n");
for(i=0; i<loop; i++){
for(j=1; j<=12; j++){
main = nstart;
for(k=1; k<=scount && k <= limit; k++){
printf("%5dx%3d=%3d", main, j, main*j);
main++;
}
printf("\n");
}
nstart+=limit;
scount-=limit;
printf("\n\n");
}
scanf (" ");
return 0;
{