用C++程序编写
- 提问者网友:不爱我么
- 2021-05-16 21:56
- 五星知识达人网友:雾月
- 2021-05-16 23:01
int f(int n)
{
if(n==1||n==0)return 1;
else return n*f(n-1);
}
vod main()
{
int n;
int m;
scanf("%d",&n);
m=f(n);
printf("n!=%d\n",m);
}
- 1楼网友:琴狂剑也妄
- 2021-05-17 00:48
=======================
#include<stdio.h> long fun(int, int, int, int); void strToSTR(char *p); void main() { int a,b,c,d; long sum; char str[] = {"abcdefg"}; printf("请输入a,b,c,d的值(用,隔开):"); scanf("%d,%d,%d,%d",&a,&b,&c,&d); sum = fun(a,b,c,d); printf("a*b+c*d = %ld\n",sum); printf("字符%s转换成大写后 = ",str); strToSTR(str); printf("%s",str); } long fun(int a, int b, int c, int d) { return (a*b+c*d); } void strToSTR(char *p) { int i; for(i = 0; p[i] != '\0'; i ++) p[i] -= 32; }
- 2楼网友:北方的南先生
- 2021-05-17 00:34
#include<iostream> using namespace std; int main() { int n,i,max = 1; cout<<"请输入n的值:"<<endl; cin>>n; for(i = 1; i <= n; i++) { max = i * max; }
cout<<n<<"!="<<max<<endl; return 0; }
- 3楼网友:渡鹤影
- 2021-05-16 23:59
- 4楼网友:酒安江南
- 2021-05-16 23:46
- 5楼网友:刀戟声无边
- 2021-05-16 23:33