自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(5)
  • 问答 (12)
  • 收藏
  • 关注

原创 在控制台任意输入n个数,用空格隔开,按回车键则求出它们的和。

1.数字输完后,按回车键出结果 #include <stdio.h> int main() { int sum=0; int input=0; printf("请输入数字:\n"); do { scanf("%d",&input); sum=sum+input; }while(getchar()!='\n'); printf("和为:%d",sum); return 0; } 2.数字输完后,先按回车键,再按ctrl+z出结果 #include <s

2022-02-19 22:27:14 1461

原创 写一个函数,求输入的数字的二进制数中有多少个1

#include <stdio.h> //第一种 int count_1(unsigned int num) { int count=0; while(num) { if(num%2==1) { count++; } num=num/2; } return count; } //第二种 int count_1s(int num) { int count=0; int i=0; for(i=1;i<=32;i++) { //将num向右移动

2022-02-19 18:58:58 500

原创 冒泡排序的实现

#include <stdio.h> //冒泡排序 void bubble_sort(int arr[],int len) { int i; for(i=0;i<len-1;i++) { int flag=1; int j=0; int tmp=0; for(j=0;j<len-1-i;j++) { if(arr[j]>arr[j+1]) { tmp=arr[j+1]; arr[j+1]=arr[j]; arr

2022-02-19 08:33:33 520

原创 求两个数的最大公约数和最小公倍数

#include <stdio.h> //最大公约数 int max_common_num(int m,int n) { int r=0;//余数 while(r=m%n) { m=n; n=r; } return n; } //最小公倍数 int min_common_num(int m,int n) { int i=max_common_num(m,n); // 最小公倍数等于两数之积除以它们的最大公约数 return m*n/i; } int mai

2022-02-18 22:22:57 190

原创 求两个数之间的回文素数

回文素数

2022-02-18 11:21:16 560

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除