hsjl.net
当前位置:首页 >> pAsCAl语言中 整除命令是什么 >>

pAsCAl语言中 整除命令是什么

div是整除,mod是求余 a div b (100 div 3 = 33) a mod b (100 mod 3 = 1)

你再把题目描述的详细点. 比如,n是干什么的?

c:=a mod b,这是取余; c:=a div b,这是整除; sin(a),指在三角形中,一个大小为a(弧度制)的角所对边与斜边的比值,如BC/AB; COS(a),指在三角形中,一个大小为a(弧度制)的相邻的非斜边与斜边的比值,如AC/AB; tan(a),是对边比另一...

用穷举法吧 program exe; var i:longint; //循环变量 s:longint; //总和 begin for i:=1000 to 9999 do //所有四位数是1000~9999,所以穷举9000次 begin if i mod 5=0 //若被5整除 then inc(s,i); //相加 end; writeln(s); //输出 end.

function isOk(n : integer) : boolean; var i : integer; begin result := pos('5',inttostr(n))>0; end; function myFunc(n:integer) : integer; var i : integer; begin result := 0 ; for i := 1 to n do begin if (i mod 5 = 0) and isok(i...

var s,i:longint; begin s:=0; for i:=1 to 1000 do begin if (i mod 3 =0) and (i mod 5=0) then s:=s+i; end; writeln(s); end. 记得采纳啊

program calc; var total: dword; i: integer; begin total := 0; for i:=1 to 1000 do if((i mod 15) = 0)then total += i; writeln('Total: ', total); end.

var i,j,s:integer; begin i:=5; s:=0; while i0)do j:=j div 10; if (j mod 5=0)and(j>0) then s:=s+1; i:=i+5; end; writeln(s:10); end.

var a,i:longint;t:boolean; begin t:=true; readln(a); if a=1 then writeln('F'); if a1 then begin for i:=2 to trunc(sqrt(a)) do if a mod i=0 then t:=false; if t then writeln('T')else writeln('F'); end; end.

var i,j,k,p,n:longint; a,s:array[1..1000]of longint;function try:boolean;var t,e,h:longint;beginh:=0;try:=false;for t:=1 to i dofor e:=h+1 to n do if s[t]=a[e] then begin h:=e;break;endelse if (s[t]a[e])and(e=n) then exit(true)...

网站首页 | 网站地图
All rights reserved Powered by www.hsjl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com