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.

#include <bits/stdc++.h>

using namespace std;

long long n,i,s;

int main()

{

cin>>n;

s=0;

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

cout<<s;

return 0;

}

19 tháng 1 2022

Var s,i,n:longint;

Begin

Write('Nhap so luong so n = ');readln(n);

For i:=1 to n do

s:=s+i*i;

Write('Tong la ',s);

Readln;

End.

26 tháng 3

#include <stdio.h>

int main(){

    int n;

    scanf("%d",&n);

    long t=0; int i,j;

    for (i=2; i<=n; i++){

        int c=0;

        for (j=2; j<i; j++)

            if (i%j==0) c++;

        if (c==0) t=t+i;

        }

printf("%d",t);

return 0;

}

9 tháng 1

Bạn trình bày lại đề bài rõ hơn nha, đề đọc rất khó hiểu ấy.

1:

#include <bits/stdc++.h>

using namespace std;

long long a,b;

int main()

{

cin>>a>>b;

cout<<a+b;

return 0;

}

2:

#include <bits/stdc++.h>

using namespace std;

double s,r;

int main()

{

cin>>r;

s=r*r*pi;

cout<<fixed<<setprecision(2)<<s;

return 0;

}

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

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

cout<<endl;

dem=0;

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

{

t=0;

for (j=1; j<=a[i]-1; j++)

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

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

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

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

cout<<t1;

return 0;

}

25 tháng 5 2022

#include <bits/stdc++.h>

using namespace std;

long long a[1000],n,i,dem,t,j,t1;

int main()

{

cin>>n;

for (i=1; i<=n; i++) cin>>a[i];

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

cout<<endl;

dem=0;

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

{

t=0;

for (j=1; j<=a[i]-1; j++)

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

if (t==a[i]) dem++;

}

cout<<dem<<endl;

t1=0;

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

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

cout<<t1;

return 0;

}

11 tháng 10 2021

#include <bits/stdc++.h>

using namespace std;

int main()

{

long long n;

cin>>n;

if (n%2==0) cout<<n<<" la so chan"<<endl;

else cout<<n<<" la so le"<<endl;

if (n<0) cout<<n<<" la so am";

else cout<<n<<" la so khong am";

return 0;

}

18 tháng 10 2021

Câu 3: 

#include <bits/stdc++.h>

using namepsace std;

double a,b,c,p,s;

int main()

{

cin>>a>>b>>c;

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));

cout<<fixed<<setprecision(2)<<s;

return 0;

}

18 tháng 10 2021

Câu 3: 

#include <bits/stdc++.h>

using namepsace std;

double a,b,c,p,s;

int main()

{

cin>>a>>b>>c;

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));

cout<<fixed<<setprecision(2)<<s;

return 0;

}

18 tháng 10 2021

Câu 3:

#include <bits/stdc++.h>

using namepsace std;

double a,b,c,p,s;

int main()

{

cin>>a>>b>>c;

p=(a+b+c)/2;

s=sqrt(p*(p-a)*(p-b)*(p-c));

cout<<fixed<<setprecision(2)<<s;

return 0;

}

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