K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

18 tháng 11 2019

cách 1: điều kiện dạng thiếu(chỉ có if, không có else)

uses crt;

var a,b:integer;

begin

clrscr;

write('nhap a='); readln(a);

write('nhap b='); readln(b);

if a<b then writeln('so nho nhat trong hai so la: ',a);

if b<a then writeln('so nho nhat trong hai so la: ',b);

if b=a then writeln('khong co so nho nhat trong hai so');

readln;

end,

cách 2: điều kiện dạng đủ

uses crt;
var a,b,c,kq:integer;
begin
clrscr;
write('nhap a='); readln(a);
write('nhap b='); readln(b);
if a<b then writeln('so nho nhat trong hai so la: ',a)
else if b<a then writeln('so nho nhat trong hai so la: ',b)
else writeln('khong co so nho nhat trong hai so');
readln;
end.

5 tháng 12 2021

Điều kiện: a<b
Câu lệnh: if a<b then write(a);

7 tháng 4 2023

program TimSoLonNhat;

var

     a, b, c, d, max: integer;

begin

     write('Nhap a: '); readln(a);

     write('Nhap b: '); readln(b);

     write('Nhap c: '); readln(c);

     write('Nhap d: '); readln(d);

     max := a;

     if b > max then

          max := b;

     if c > max then

          max := c;

     if d > max then

          max := d;

     writeln('So lon nhat la: ', max);

     readln;

end.

7 tháng 4 2023

program TimSoLonNhat;

var a, b, c, d: integer; 

begin
  writeln('Nhap vao gia tri cua a: ');
  readln(a);
  writeln('Nhap vao gia tri cua b: ');
  readln(b);
  writeln('Nhap vao gia tri cua c: ');
  readln(c);
  writeln('Nhap vao gia tri cua d: ');
  readln(d);

  if (a > b) and (a > c) and (a > d) then
    writeln('So lon nhat la: ', a)
  else if (b > a) and (b > c) and (b > d) then
    writeln('So lon nhat la: ', b)
  else if (c > a) and (c > b) and (c > d) then
    writeln('So lon nhat la: ', c)
  else
    writeln('So lon nhat la: ', d);
    readln;
end.

7 tháng 4 2023

program TimSoLonNhat;

var a, b, c, d: integer; 

begin
  writeln('Nhap vao gia tri cua a: ');
  readln(a);
  writeln('Nhap vao gia tri cua b: ');
  readln(b);
  writeln('Nhap vao gia tri cua c: ');
  readln(c);
  writeln('Nhap vao gia tri cua d: ');
  readln(d);

  if (a > b) and (a > c) and (a > d) then
    writeln('So lon nhat la: ', a)
  else if (b > a) and (b > c) and (b > d) then
    writeln('So lon nhat la: ', b)
  else if (c > a) and (c > b) and (c > d) then
    writeln('So lon nhat la: ', c)
  else
    writeln('So lon nhat la: ', d);
    readln;
end.

#include <bits/stdc++.h>

using namespace std;

int main()

{

int n,t=0;

cin>>n;

for (int i=1; i<=n; i++)

if (i%6==0) t+=i;

cout<<t;

return 0;

}

a: 125 mod 5<>0

b: 

uses crt;

var i,t:integer;

begin

clrscr;

t:=0;

for i:=1 to 50 do t:=t+i;

write(t);

readln;

end.

c: for <biến đếm>:=<giá trị đầu> to <giá trị cuối> do <câu lệnh>;

d: 

Dạng thiếu: if <điều kiện> do <câu lệnh>;

Dạng đủ: if <điều kiện> do <câu lệnh 1> else <câu lệnh 2>;

30 tháng 3 2022

đúng ko vậy:))

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

if (i%2==0) t+=i;

cout<<t;

return 0;

}

 

 

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

t=0;

for (i=1; i<=n; i++)

if (i%2!=0) t+=i;

cout<<t;

return 0;

}

 

19 tháng 12 2021

2:

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<a%b<<endl;

cout<<a/b;

return 0;

}