A SUPER SIMPLE ADDITION PROBLEM FOR PASCAL

Updated on society 2024-04-10
6 answers
  1. Anonymous users2024-02-07

    You're so good, readln, it's not like you can only read one data. Instead, it reads a specified amount of data, such as readln(a,b); Only two data can be read and stored in A and B. respectively

    e.g. readln(a,b,c); Only three data can be read and stored in a, b, and c

    Your mistake should be that the definition of the variable after var can only be ':'

    Moreover, it is recommended to save the value of the sum of a and b to the variable c, and a, b, and c are all set to long integers;

    That's right**. program abcs;

    vara,b,c:longint;(a, b followed by colons, and variables set to long integers).

    beginreadln(a,b);

    c:=a+b;

    writeln(c);

    end.

  2. Anonymous users2024-02-06

    It's too simple, readln, can only read one data. Encounter the end of carriage return.

    That's right**. program abcs;

    vara,b:integer;

    readln(a);

    readln(b);

    writeln(a+b);

    end.

  3. Anonymous users2024-02-05

    var a,b:integer;

    beginreadln(a,b);

    writeln(a+b);

    end.That's it.

    No C, no program

  4. Anonymous users2024-02-04

    Yes, the answer is 4.

    You go from n=1,2,3,4,......Keep arranging, and you can find the pattern when you count it to n=7 or 8, even if it is manual, it is very fast.

  5. Anonymous users2024-02-03

    The upstairs is very clear, and it is simple to figure out the law of the cycle. (1,2,3,4,5,-1) is a cycle. 16/6=2...4, so the end result is 4.

  6. Anonymous users2024-02-02

    First of all, this is a very common problem for beginners, and if you use the general solution to enumerate, it is easy to write the following **:

    If a rooster costs 5 money, there will be a maximum of 19 roosters; If a hen costs 3 dollars, there will be a maximum of 33 hens; Thus let i and j cycle from 1 19 and 1 33 respectively).

    var i,j,k:integer;

    beginfor i:=1 to 19 do

    for j:=1 to 33 do

    begink:=100-i-j;k is the number of chicks;

    if k mod 3<>0 then continue;

    if 5*i+3*j+k div 3=100 then

    writeln(i:5,j:5,k:5);

    end;end.

    But if you think about it, you can do even better!

    Note that since x, y, and z are all integers, I also take the whole number of the above range of x, which itself has fractions.

    **Write it out like this:

    var x:integer;

    beginfor x:=26 to 28 do

    writeln(4*x-100:5,200-7*x:5,3*x:5);

    end.

Related questions
9 answers2024-04-10

program divided;var n,i,s:integer;begin s:=0;counters, which are used to count about a number of numbers; readln(n);Enter the original number; for i: >>>More

4 answers2024-04-10

I just did this topic 77 is a classic Josephian problem that is very famous in algorithm design, the monkey chooses the king, the number is reported with a password, and the fox chases the rabbit is its variation. >>>More

5 answers2024-04-10

Basically, it can be understood that the left is radical and the right is conservative and backward. This kind of thing is all talking about each other and attacking each other. There are no obvious criteria for differentiation and judgment.

10 answers2024-04-10

Because relative to the AC signal, 12V is equivalent to a short circuit between 12V and the ground, RB is connected to the base at one end, and the other end is connected to 12V, which is also equivalent to grounding, because compared to the AC signal, 12V has been short-circuited to the ground, and 12V is the ground, so the RB in Figure B becomes parallel with the base-emitter. Why is a power supply equivalent to a short circuit for alternating current? Since this explanation is more troublesome, I won't say much here, but you can think of it this way, both ends of the power supply are generally connected with a large capacitor in parallel, because the capacitor is also equivalent to a short circuit relative to alternating current, which is equivalent to a wire, why? >>>More

8 answers2024-04-10

It's nonsense to say so much above. Landlord please see: pay attention to your program: printf("%d,%d",(a,b),(b,a); >>>More