02 2025 档案
摘要:1.求整数的位数及各位数字之和,对于给定的正整数 N,求它的位数及其各位 数字之和。 输入示例: 9875 输出示例: 4 29 简化版 #include <stdio.h> int main() { int number,sum=0,count=0; printf("请输入一个正整数:"); sc
阅读全文
摘要:1. 直接插入排序 #include <stdio.h> void insertionSort(int arr[], int n) { for (int i = 1; i < n; i++) { int key = arr[i]; int j = i - 1; // 将大于 key 的元素移动到后面
阅读全文
摘要:顺序查找的实现 #include <stdio.h> #define SIZE 10 // 静态查找表的大小 // 顺序查找函数 int sequentialSearch(int arr[], int size, int target) { for (int i = 0; i < size; i++
阅读全文