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.

Bài 1: 

#include <bits/stdc++.h>

using namespace std;

long long a[10],n,i,t;

int main()

{

n=0;

do 

{

cin>>a[i];

}

while ((a[i]==0) or (n==10));

for (i=1; i<=n; i++) cout<<a[i]<<" ";

cout<<endl;

t=0;

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

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

cout<<t;

return 0;

}

24 tháng 1 2022

bạn có thể code bằng c căn bản chỉ dùng printf while vs for thôi đc ko bạn

 

uses crt;

var x:real;

begin

clrscr;

repeat

  write('Nhap diem:'); readln(x);

until (0<=x) and (x<=10) and ((frac(x)=25) or (frac(x)=5) or (frac(x)=75) or (frac(x)=0));

writeln(x:4:2);

readln;

end.

uses crt;

var n,dem:integer;

begin

clrscr;

dem:=0;

repeat

write('Nhap n='); readln(n);

dem:=dem+1;

until n=0;

writeln(dem);

readln;

end.

uses crt;

var n,t1:integer;

s:real;

begin

clrscr;

t1:=0;

s:=1;

repeat

readln\(\left(n\right)\);

if n mod 2=0 then t1:=t1+n

else s:=s*n;

until n=0;

writeln\(\left(t1\right)\);

writeln\(\left(s:4:2\right)\);

readln;

end.

uses crt;

var n,i,t1,t2:integer;

begin

clrscr;

t1:=0;

t2:=0;

repeat

readln(n);

if n mod 2=0 then t1:=t1+n

else t2:=t2+n;

until n=0;

writeln(t1,' ',t2);

readln;

end.

uses crt;

var n,t:integer;

{------------------kiem-tra-so-nguyen-to----------------------------}

function ktnt(x:integer):boolean;

var i:integer;

kt:boolean;

begin

kt:=true;

for i:=2 to trunc(sqrt(x)) do 

  if x mod i=0 then 

begin

kt:=false;

break;

end;

if kt=true then ktnt:=true

else ktnt:=false;

{----------------------chuong-trinh-chinh------------------------}

begin

clrscr;

t:=0;

repeat

  write('Nhap n='); readln(n);

if (n mod 2=0) then t:=t+n;

until ktnt(n)=false;

writeln(t);

readln;

end.

10 tháng 3 2022

???

10 tháng 3 2022

???