编写程序,循环输入整数,求他们的总和与平均值
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/11 14:18:03
cleardimea(3)a=0fori=1to3input"请输入第"+alltrim(str(i))+"个数"toa(i)endform=a(1)fori=2to3ifa(i)>mthenm=a(
你看这有没有问题#includeintm;main(){inti,a,n;for(i=0;i80){m=a;}}n=m/50;printf("平均分是%d",n);}
X=[1;8;6;2;7];fori=2:length(X)-1X(i)-X(i-1)end
你没要求具体的语言,用VB给你写一个吧.subchkNumdimNumasintegerdimlenNasintegerdimiasintegerdimsumNasintegerdimstrNasst
三个空分别填:x/2k*(a&&b)printf按位与是将两个二进制数的对应位逐一地进行逻辑与操作.与的运算规则是两个数只要有一个为0,则其逻辑与的结果就为0举个例子你就明白了!定义:a=135,b=
#include#defineNUM6//n=6则写6,n=15则写15voidmain(){inti,j,k;for(i=0;i0;j--)//控制空格{printf("");}for(k=0;k
main(){inta=0,i;scanf("%d",&a);for(i=0;i
#includeintmain(){inta,b,c;printf("输入三个数");scanf("d%d%d%",acb,c);intt,k;t=a>b?a:b;k=t>c?t:c;printf("
namespace ConsoleApplication9{ class Program  
#includevoidmain(){intx=0,y;printf("输入X\n");scanf("%d",&x);if(x=1&&x=10){y=3*x-11;}printf("y=%d\n",y
'最大公约数FunctiongetGcd(num1AsLong,num2AsLong)AsLongDimiAsLongFori=IIf(num1Ifnum1Modi=0Andnum2Modi=0The
#include#includeintmain(void){intn,sum=0,count=0,s;printf("输入一个整数:");scanf("%d",&n);while(n){s
intsum=0,p,k,n;inti=1;scanf("%d",&n);do{p=1;for(k=i;k>0;k--){p*=k;}sum=sum+p;}whil
#includevoidmain(){intn;printf("请输入一个正整数:");scanf("%d",&n);intsum=0;if(n%2==1){for(inti=1;i
intsum=0;//for循环for(inti=1;i
#include“stdio.h"voidmain(){\x09inta,b,c,sum;\x09floatave;scanf("%d%d%d",&a,&b,&c);sum=a+b+c;\x09ave
INPUTxa=xMOD2IFa=0THENPRINT"x是偶数"ELSEPRINT"x是奇数"ENDIFEND
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceConsoleApplic
ifxmod2=0thenmsgbox"是偶数"elsemsgbox"是奇数"
使用什么VB的话是INPUTNIFN\2=0THENPRINT'是'ELSEPRINT'否'ENDIFEND