Output :
- 5x1=5
- 4x2=8 5x2=10 6x2=12
- 3x3=9 4x3=12 5x3=15 6x3=18 7x3=21
- 2x4=8 3x4=12 4x4=16 5x4=20 6x4=24 7x4=28 8x4=32
- 1x5=5 2x5=10 3x5=15 4x5=20 5x5=25 6x5=30 7x5=35 8x5=40 9x5=45
- 2x6=12 3x6=18 4x6=24 5x6=30 6x6=36 7x6=42 8x6=48
- 3x7=21 4x7=28 5x7=35 6x7=42 7x7=49
- 4x8=32 5x8=40 6x8=48
- 5x9=45
##ReadMore##
Source Code :
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int a = 5;
- int b = 5;
- for(int y = 1; y <= 9; y++) {
- for(int x = 1; x <= 9; x++) {
- if(x >= a && x <= b) {
- printf("%dx%d=%d\t", x, y, x*y);
- }else{
- printf("\t");
- }
- }
- if(y < 5) {
- a -= 1;
- b += 1;
- }else{
- a += 1;
- b -= 1;
- }
- printf("\n");
- }
- system("PAUSE");
- return 0;
- }
0 回應:
張貼留言