| |

VerySource

 Forgot password?
 Register
Search
View: 1597|Reply: 11

How to achieve prime numbers between 2 and 500 using SQL statements? ? Trouble ~~~

[Copy link]

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-2-15 22:00:01
| Show all posts |Read mode
RT, thank you! !! !! !!
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-4-17 20:15:02
| Show all posts
Why use Sql statement?
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-4-18 07:00:01
| Show all posts
Forced ~~
Hehe ~~~
Trouble master help ~
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-4-19 20:00:01
| Show all posts
God ~~~
Save me ~~~
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-20 09:00:01
| Show all posts
#include "stdio.h"
main ()
{
int a [501], i, j;
for (i = 2; i <= 500; i ++)
a [i] = i;
   for (i = 2; i <4; i ++)
        printf ("% d", a [i]);
for (i = 4; i <= 500; i ++)
{
for (j = 2; j <i; j ++)
if (a [i]% j == 0) break;
The
else if (i == j + 1)
printf ("% d", a [i]);
The
}
The

}
Reply

Use magic Report

0

Threads

3

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-20 10:15:01
| Show all posts
Halo, use SQL, depressed
Reply

Use magic Report

1

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-4-21 17:45:01
| Show all posts
Hehe ~~~
Help the younger brother to be depressed for a while, SQL is not a big deal ~~
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-5-20 12:00:01
| Show all posts
I really don't know how to use Sql statement ..

Learn to help ...
Reply

Use magic Report

0

Threads

31

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-5-25 12:00:02
| Show all posts
Reply

Use magic Report

0

Threads

31

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-5-25 12:15:01
| Show all posts
Interesting, try with a temporary table + cursor, the important thing is to make a loop and record

If you have time, you must write a play for yourself, the landlord ’s idea is very wonderful.

select num from numtable where num% @ i <> 0

numtable stores raw data 2-500, @i is a loop variable
You can use a cursor to make a small loop, and try to filter it with a surface sentence to see if it can come out
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