| |

VerySource

 Forgot password?
 Register
Search
View: 832|Reply: 6

Find the code of an applet

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-18 18:00:01
| Show all posts |Read mode
Design a C program that outputs the following ninety-nine multiplication table:
    1 2 3 4 5 6 7 8 9
1 1 2 3 4 5 6 7 8 9
2 2 4 6 8 10 12 14 16 18
3 3 6 9 12 15 18 21 24 27
4 4 8 12 16 20 24 28 32 36
5 5 10 15 20 25 30 35 40 45
6 6 12 18 24 30 36 42 48 54
7 7 14 21 28 35 42 49 56 63
8 8 16 24 32 40 48 56 64 72
9 9 18 27 36 45 54 63 72 81


Brother is very anxious, trouble as soon as possible, thank you!
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-27 00:54:01
| Show all posts
#include <stdio.h>
int main ()
{int i, j;
  for (i = 1; i <9; i ++) printf ("% 5d", i);
  for (i = 1; i <= 9; i ++) {
    printf ("% d", i);
    for (j = 1; j <9; j ++) printf ("% 4d", i * j);
    printf (\n);
  }
}
Reply

Use magic Report

0

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-27 05:36:01
| Show all posts
#include <stdio.h>
int main ()
{int i, j;
  for (i = 1; i <= 9; i ++) printf ("% 5d", i);
  for (i = 1; i <= 9; i ++) {
    printf ("% d", i);
    for (j = 1; j <= 9; j ++) printf ("% 4d", i * j);
    printf (\n);
  }
}
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Unknown

Post time: 2020-1-27 10:36:01
| Show all posts
#include <stdio.h>

main ()
{
int i, j;

for (i = 1; i <= 9; i ++)
printf ("% 4d", i);
printf ("\n");

for (i = 1; i <= 9; i ++) {
printf ("% 1d", i);
for (j = 1; j <= 9; j ++)
printf ("% 4d", j * i);
printf ("\n");
}
}
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-27 11:36:01
| Show all posts
Tested NO issues
Is this homework?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-27 14:36:01
| Show all posts
#include <stdio.h>
main ()
{
int i, j, k = 0;
char buffer [1000];
for (i = 0; i <10; i ++)
{
if (i == 0)
{
k = sprintf (buffer, "\t");
for (j = 1; j <10; j ++) k + = sprintf (buffer + k, "% d\t", j);
}
else
{
for (j = 0; j <10; j ++)
if (j == 0) k + = sprintf (buffer + k, "% d\t", i);
else k + = sprintf (buffer + k, "% d\t", i * j);
}
sprintf (buffer + k, "\n");
}
printf ("% s", buffer);
}
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-1 12:36:01
| Show all posts
#include <cstdlib>
#include <iostream>
using namespace std;
int main (int argc, char * argv [])
{
    int i, j;
    for (i = 1; i <= 9; i ++)
    {
        printf ("% 3d", i);
    }
    printf ("\n");
    for (i = 1; i <= 9; i ++) {
        printf ("% d", i);
        for (j = 1; j <= 9; j ++)
        {
            printf ("% 2d", i * j);
        }
        printf ("\n");
    }
    system ("PAUSE");
    return EXIT_SUCCESS;
}

DEV-C ++ compiled
No problem in normal operation
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list