用c语言程序计算sum=1 1/2 1/3 - 1/50.
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/10 22:56:16
sum=sum+*(a+n)a是一个地址,+n是指指向后面的第n个地址*(a+n)是取数组a[n]的数值
#include"stdio.h"voidfun(intn,intk){intj;doublesum=0;for(j=1;j
#include#includevoidmain(){intN,sum,i;sum=0;printf("N=");scanf("%d",&N);printf("sum=");for(i=1;i
#include#include#includeintmain(void){longn,x,jc=1,t;doublesum=1;scanf("%d%d",&n,&x);for(inti=1;i再问:
#include<stdio.h>main(){ int n; double a,sum=0; printf("请输入N的值:&
#includemain(){doublex,y;scanf("%lf",&x);if(x
#includeintfact(intn){if(n==0||n==1)return1;elsereturnn*fact(n-1);}intmain(){printf("5!+10!=%d\n"
#include#includevoidmain(){doublecoe[20],x,sum=0;inti,n;printf("请输入总项数:");scanf("%d",&n);printf("请按指
sum/=i等效于sum=sum/i相当于:把sum除以i,所得的商,赋值给sum
//这个不需要使用breakintfun(){inti=sum=0;if(;sum
我刚刚编的,可以.不知道是不是你所要的.#includevoidmain(){intn;printf("欢迎来到计算整数的三次方的程序!\n");printf("请输入您要计算的数:");scanf(
#include <stdio.h>int main(){ float x, tax = 0;
longsum_ji(intx)//奇数之和{if(x%2==0){x--;}return(long)x*(long)x/4;}longsum_ou(intx)//偶数之和{if(x%2!=0){x-
#includemain(){inti,m=0;for(i=1;i
因为3个加法的运算规律是相同的,使用一个函数来计算循环值#includeintfun(intn)//计算累加结果函数{//这里还可以判断下n是否小于等于0intsum=0;inti;for(i=1;i
你先把公式告诉我,我帮你写
main(){inta,b,c;c=a+b;scanf("%d%d",&a,&b);printf("%d",c);}
#includevoidmain(){intn=1,N,i;scanf("%d",&N);if(N20)printf("shuruwuxiao!\n");else{for(i=1;i
#includeintmain(){inti,s=0;for(i=1;i
#includevoidmain(){inti,j,n,sum=0;printf("输入计算组数i:");scanf("%d",&i);printf("\n");while(i--){scanf("%