-
vari,ans:integer;
beginans:=0;Initialize.
for i:=1 to 100 do
if odd(i) is a function to find the odd and even, the odd number is true, and the even number is falseinc(ans,i); Statistics.
writeln(ans);Output.
end.
-
The formula for summing the difference series: (1+99)*50 2=2500
-
(1) The procedure is as follows:
set talk off
s=0i=1
do while i<=100
s=s+ii=i+2
The enddos result is: 2500
2) The procedure is as follows:
set talk off
s=0i=1
do while i<=100
s=s+ii=i+1
The enddos result is: 5050
-
var a,b,t:double; n,i:integer;
begina:=1; b:=1;
write(1,' ',1,' ');
n:=5000;
for i:=3to n do
begint:=b;
b:=b+a;
a:=t;write(trunc(b),' ')
end;end.
10,000 is ridiculously high.
I can only output the first 92 items up to double with double.
10,000 or 5,000 entries will probably be beyond the range of 500 high-precision strings, so what do you want to do?
If you have to, you can add the compiler switch yourself.
-
You write a subfunction first, and then the main function calls summing.
function f=ffib(n)
if n>2
f=ffib(n-1)+ffib(n-2);
elsef=1;
It's easy to write the main function of the sum of end.
-
Violent? Tree-like arrays? Segment tree? Balance Tree? Please give a specific topic. Not sure what the hell you're asking.
-
Interval summing? What do you mean?
-
var n,m,i,k:longint;
beginreadln(n);
m:=0;for i:=1 to n dobeginread(k);
m:=m+k;
end;writeln(m);
end.You're a beginner, right? What this program means is to read a number and add it up to m, which is very simple.
If you don't know it in the future, you can come to me and ask me if I can learn pascal too. Thanks.
Redmi Airdots 2 True Wireless Bluetooth Earbuds >>>More
This can be done with the built-in sum function.
**As follows: print("The sum of all odd numbers up to 100 is: %d" %sum(range(1,100,2))) >>>More
<> even numbers within 100.
An even number is an integer that is divisible by 2. Positive even numbers are also called even numbers. If a number is a multiple of 2, it is an even number and can be expressed as 2n; If not, it is an odd number, which can be expressed as 2n+1 (n is an integer), that is, the remainder of the odd number divided by two is one. >>>More
A composite number, also known as a composite number, is a positive integer that satisfies any of the following (equivalence) conditions: >>>More
Winter scenery essay 150 words(a).
I sat at the window, listening to the knock of the north wind, the sound of destroying the branches, and the occasional barking of dogs from afar. The kitten under the eaves can't resist the invasion of the cold snap, and it's also so cold that it "meows..."Meow...."The screaming is non-stop. >>>More