c function
/*
#include<stdio.h> int is_prime(int n)
{
for(int i = 2; i <= n/2; i ++)
if(n % 2 == 0)
return 0;
return 1;
} int main()
{
int n; printf("Enter a number(exit when n<=1):");
scanf("%d", &n);
if(is_prime(n) && n > 1)
printf("%d is a prime number", n);
else if(n > 1)
printf("%d is not a prime number", n);
else
; return 0;
} #include<stdio.h> int is_prime(int n)
{
for(int i = 2; i <= n/2; i ++)
if(n % 2 == 0)
return 0;
return 1;
}
int main() {
int n; printf("Enter a even number(n>=6):");
scanf("%d", &n);
if(n < 6 || n%2 != 0)
printf("error: illegal input\n");
else
for(int i = 2; i <= n/2; i ++)
if(is_prime(i) && is_prime(n-i))
printf("%d = %d + %d\n", n, i, n-i);
return 0;
} #include<stdio.h>
int fac(int x)
{
if(x == 1)
return 1;
else
return x*fac(x-1);
}
int main()
{
int n, m;
int result; printf("Enter the value of n and m:");
scanf("%d %d", &n, &m);
result = fac(n)/(fac(n-m)*fac(m));
printf("Result is %d\n", result);
return 0;
} #include<stdio.h> void selectMaxAndMin(int A[][4], int row, int c)
//int A[][]: array type has incomplete element type ?
{
int max, min; max = min = A[0][0];
for(int i = 0; i < row; i ++)
for(int j = 0; j < c; j ++){
if(A[i][j] > max)
max = A[i][j];
if(A[i][j] < min)
min = A[i][j];
}
printf("max = %d, min = %d\n", max, min);
} void main()
{
int A[4][4] = {1, 5, 3, 6,
2, 4, 5, 7,
3, 9, 8, 0,
4, 1, 9, 5}; selectMaxAndMin(A, 4, 4);
} #include<stdio.h> char trans(char c)
{
if(c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z')
return c+4;
else
return c;
}
void main()
{
char s[100];
char c;
int i; i = 0;
while((c = getchar()) != '\n')
s[i++] = trans(c);
s[i] = '\0';
printf("%s\n", s);
} #include<stdio.h>
#define ROW 2
#define COL 3 void trans(int arr[100][100])
//int arr[][100] 无法正常传值????
{
int k = 0; printf("transArr:\n");
for(int i = 0; i <= COL; i ++){
for(int j = 0; j <= ROW; j ++)
printf("%5d", arr[j][i]);
printf("\n");
}
}
void main()
{
int oriArr[100][100]; printf("Enter the value of oreArr:\n");
for(int i = 0; i <= ROW; i ++)
for(int j = 0; j <= COL; j ++){
printf("oriArr[%d][%d]=", i, j);
scanf("%d", &oriArr[i][j]);
}
printf("oriArr:\n");
for(int i = 0; i <= ROW; i ++){
for(int j = 0; j <= COL; j ++)
printf("%5d", oriArr[i][j]);
printf("\n");
}
trans(oriArr);
} #include<stdio.h> char s[100];
void My_char(int i)
{
if(i == 0)
printf("%c", s[0]);
else{
printf("%c", s[i]);
My_char(i-1);
}
}
int main()
{
char c;
int i; i = 0;
printf("Enter a String:\n");
while((c = getchar()) != '\n')
s[i++] = c;
printf("After be reverse:\n");
My_char(i-1); } */
c function的更多相关文章
- 通过百度echarts实现数据图表展示功能
现在我们在工作中,在开发中都会或多或少的用到图表统计数据显示给用户.通过图表可以很直观的,直接的将数据呈现出来.这里我就介绍说一下利用百度开源的echarts图表技术实现的具体功能. 1.对于不太理解 ...
- jsp中出现onclick函数提示Cannot return from outside a function or method
在使用Myeclipse10部署完项目后,原先不出错的项目,会有红色的叉叉,JSP页面会提示onclick函数错误 Cannot return from outside a function or m ...
- JavaScript function函数种类
本篇主要介绍普通函数.匿名函数.闭包函数 目录 1. 普通函数:介绍普通函数的特性:同名覆盖.arguments对象.默认返回值等. 2. 匿名函数:介绍匿名函数的特性:变量匿名函数.无名称匿名函数. ...
- 在ubuntu16.10 PHP测试连接MySQL中出现Call to undefined function: mysql_connect()
1.问题: 测试php7.0 链接mysql数据库的时候发生错误: Fatal error: Uncaught Error: Call to undefined function mysqli_con ...
- jquery中的$(document).ready(function() {});
当文档载入时执行function函数里的代码, 这部分代码主要声明,页面加载后 "监听事件" 的方法.例如: $(document).ready( $("a") ...
- Function.prototype.toString 的使用技巧
Function.prototype.toString这个原型方法可以帮助你获得函数的源代码, 比如: function hello ( msg ){ console.log("hello& ...
- 转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38
转:ORA-15186: ASMLIB error function = [asm_open], error = [1], 2009-05-24 13:57:38http://space.itpub. ...
- [Xamarin] 透過Native Code呼叫 JavaScript function (转帖)
今天我們來聊聊關於如何使用WebView 中的Javascript 來呼叫 Native Code 的部分 首先,你得先來看看這篇[Xamarin] 使用Webview 來做APP因為這篇文章至少講解 ...
- Oracle数据库自动备份SQL文本:Procedure存储过程,View视图,Function函数,Trigger触发器,Sequence序列号等
功能:备份存储过程,视图,函数触发器,Sequence序列号等准备工作:--1.创建文件夹 :'E:/OracleBackUp/ProcBack';--文本存放的路径--2.执行:create or ...
- javascript中的Function和Object
写的很好,理解了很多,特此转发记录 转自:http://blog.csdn.net/tom_221x/archive/2010/02/22/5316675.aspx 在JavaScript中所有的对象 ...
随机推荐
- count(*)、count(val)和count(1)的解释
一.关于count的一些谣言: 1.count(*)比count(val)更慢!项目组必须用count(val),不准用count(*),谁用扣谁钱! 2.count(*)用不到索引,count(va ...
- php中的curl】php中curl的详细解说
本文我来给大家详细介绍下cURL的简单的使用方法,下文我将会给大家详细介绍cURL的高级应用, cURL可以使用URL的语法模拟浏览器来传输数据, FTP, FTPS, HTTP, HTTPS, GO ...
- [转] Xcode4.4.1下安装高德地图详细教程
转载地址:http://blog.csdn.net/mad1989/article/details/7913404 此教程和官方的没有太大区别,省略了好多没用的步骤,添加framework的方式是最新 ...
- sql 取时间 问题集
一. AND B.TRAFFICE_DATE>dateadd(day,5,(select getdate())) dateadd(day,5,(select getdate())):为当前时间+ ...
- java中MD5加密的小使用
最近项目中需要用到md5加密,就自己在网上看了看. package com.wxgs.ch01; import java.security.MessageDigest; import java.sec ...
- c# XML省市联动
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- poj2395 Out of Hay
题意就是给你一张无向连通图,试问对于图上所有点对(u,v)从u到v的所有路径中边权最大值的最小值的最大值. 定义f(u,v)表示从u到v所有路径中边权最大值的最小值,对所有点对取其最大. 实际上就是求 ...
- Bone Collector II
Bone Collector II Time Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
- Spring声明式事务管理与配置详解
转载:http://www.cnblogs.com/hellojava/archive/2012/11/21/2780694.html 1.Spring声明式事务配置的五种方式 前段时间对Spring ...
- Entity Framework 第三篇 实体特性声明
Entity Framework中对实体的特性声明有着严格的要求 1.实体必须要有主键特性,但是如果实体没有主键特性那怎么办? public int ExecuteSqlCommand(string ...