当前位置:网站首页>Absolute primes (C language)
Absolute primes (C language)
2022-07-06 21:16:00 【Bamboo pride】
problem : Write a program , Enter two positive integers , Output absolute primes between two positive integers ;
Operation diagram :
Source code :
#include <stdio.h>
int main()
{
int a,b;
int i,x,y,z;
int h=0,v;
scanf("%d %d",&a,&b);
for(i=a;i<=b;i++)
{
int j;
for(j=2;j<i;j++)
{
if(i%j==0)
{
break;
}
}
if(j==i)
{
i=j;
x=i%10;
y=(i%100)/10;
z=i/100;
if(z==0)
{
h=x*10+y;
}
if(z>0)
{
h=x*100+y*10+z;
}
h=h;
for(v=2;v<h;v++)
{
if(h%v==0)
{
break;
}
}
if(v==h)
{
printf("%d\n",i);
}
}
}
return 0;
}
边栏推荐
- JS operation DOM element (I) -- six ways to obtain DOM nodes
- for循环中break与continue的区别——break-完全结束循环 & continue-终止本次循环
- 2017 8th Blue Bridge Cup group a provincial tournament
- 过程化sql在定义变量上与c语言中的变量定义有什么区别
- How do I remove duplicates from the list- How to remove duplicates from a list?
- None of the strongest kings in the monitoring industry!
- Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
- Redis insert data garbled solution
- [sliding window] group B of the 9th Landbridge cup provincial tournament: log statistics
- ICML 2022 | flowformer: task generic linear complexity transformer
猜你喜欢
爱可可AI前沿推介(7.6)
KDD 2022 | 通过知识增强的提示学习实现统一的对话式推荐
Swagger UI教程 API 文档神器
拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条
15million employees are easy to manage, and the cloud native database gaussdb makes HR office more efficient
ICML 2022 | flowformer: task generic linear complexity transformer
LLVM之父Chris Lattner:为什么我们要重建AI基础设施软件
PHP saves session data to MySQL database
[redis design and implementation] part I: summary of redis data structure and objects
SAP Fiori应用索引大全工具和 SAP Fiori Tools 的使用介绍
随机推荐
None of the strongest kings in the monitoring industry!
Comprehensive evaluation and recommendation of the most comprehensive knowledge base management tools in the whole network: flowus, baklib, jiandaoyun, ones wiki, pingcode, seed, mebox, Yifang cloud,
[200 opencv routines] 220 Mosaic the image
【OpenCV 例程200篇】220.对图像进行马赛克处理
Mtcnn face detection
Laravel notes - add the function of locking accounts after 5 login failures in user-defined login (improve system security)
038. (2.7) less anxiety
Yyds dry inventory run kubeedge official example_ Counter demo counter
How do I remove duplicates from the list- How to remove duplicates from a list?
The biggest pain point of traffic management - the resource utilization rate cannot go up
Infrared thermometer based on STM32 single chip microcomputer (with face detection)
Pat 1085 perfect sequence (25 points) perfect sequence
Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
How to implement common frameworks
防火墙基础之外网服务器区部署和双机热备
Web开发小妙招:巧用ThreadLocal规避层层传值
After working for 5 years, this experience is left when you reach P7. You have helped your friends get 10 offers
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
968 edit distance
ICML 2022 | flowformer: task generic linear complexity transformer