0% found this document useful (0 votes)
22 views29 pages

Laboratoriya 2

Uploaded by

Tunar Memmedli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views29 pages

Laboratoriya 2

Uploaded by

Tunar Memmedli
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

While operatoru:

1)
#include <iostream>

using namespace std;

int main() {

double x,k;

cin>>x; //1536

k=0;

while (x>0) {

x=x/10;

k=k+1;

cout<<k;

return 0;

}
2)
#include <iostream>

using namespace std;

int main() {

int x,k,a;

k=0;

cin>>x;

while (x>0){

a=x%10;

k=k+(a*a);

x=x/10;

cout<<k;

return 0;

}
3)
#include <iostream>

using namespace std;

int main() {

int x,a,b,c;

cin>>x;

a=0;

b=0;

while (x>0){

c=x%10;

if (c%2==0){

a=a+1;

else{

b=b+1;

x=x/10;

cout<<”cut ededlerin sayi: “<<a<<endl;

cout<<”tek ededlerin sayi: “<<b<<;

return 0;

}
4)
#include <iostream>

using namespace std;

int main() {

int a,k;

cin>>a;

k=0;

while (a>0){

k=k*10+(a%10);

a=a/10;

cout<<"ededin tersi:"<<k;

return 0;

}
5)
#include <iostream>

using namespace std;

int main() {

int a,k,c;

cin>>a;

c=a;

k=0;

while (c>0){

k=k*10+(c%10);

c=c/10;

cout<<"cem:"<<a+k;

return 0;

}
6)
#include <iostream>

using namespace std;

int main() {

int a,b,c;

cin>>a;

b=a%10;

while (a>0){

c=a%10;

a=a/10;

cout<<b+c;

return 0;

}
7)
#include <iostream>

using namespace std;

int main() {

int a,b,c,k,d;

k=0;

cin>>a;

d=a;

b=d%10;

while (d>0){

c=d%10;

d=d/10;

while (a>0){

k=k+a%10;

a=a/10;

cout<<k-b-c;

return 0;

}
8)
#include <iostream>

using namespace std;

int main (){

int a,b;

cin>>a;

b=0;

while (a>0){

if (a%10!=4 and a%10!=7){

b=b+1;

a=a/10;

cout<<b;

return 0;

}
9)
#include <iostream>

using namespace std;

int main (){

int a,b,c;

cin>>a;

b=a;

c=0;

while (b>0) {

c=c*10+b%10;

b=b/10;

if (a==c){

cout<<"YES";

else {

cout<<"NO";

return 0;

}
10)
#include <iostream>

using namespace std;

int main(){

int a,b,c,k;

cin>>a;

b=a%10;

k=0;

while (a>0){

c=a%10;

if (b==c){

k=k+1;

b=c;

a=a/10;

if (k==1){

cout<<"NO";

else{

cout<<"YES";

return 0;

}
11)
#include <iostream>

using namespace std;

int main(){

int a,b,c;

cin>>a;

b=a%10;

while (a>0) {

c=a%10;

a=a/10;

if ((b+c)%2==0){

cout<<"Cut ededdir.";

else {

cout<<"Tek ededdir.";

return 0;

}
12)
#include <iostream>

using namespace std;

int main() {

int a,b;

cin>>a;

b=0;

while (a>0) {

if (a%10!=0){

b=b*10+a%10;

a=a/10;

a=0;

while(b>0){

a=a*10+b%10;

b=b/10;

cout<<a;

return 0;

}
13)
#include <iostream>

using namespace std;

int main(){

int n,a,b;

cin>>n;

while(n>0){

b=n;

a=0;

while (b>0){

a=a*10+b%10;

b=b/10;

if(a==n){

cout<<a<<endl;

n=n-1;

return 0;

}
For Operatoru

1)
#include<iostream>

using namespace std;

int main(){

int x,n,y,z;

cout<<"x daxil et:";

cin>>x;

cout<<"n daxil et:";

cin>>n;

y=1;

z=1;

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

y=y*(x+i);

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

z=z*(x+i);

cout<<y/z;

return 0;

}
2)
#include <iostream>

using namespace std;

int main() {

int n;

double x,y;

y=1;

cout<<"n daxil et: ";

cin>>n;

cout<<"x daxil et: ";

cin>>x;

if (n==0){

y=1;

else if (n<0){

for (int i=1;i<=(n*(-1));i=i+1){

y=y*x;

y=1/y;

else{

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

y=y*x;

cout<<y;

return 0;

}
3)
#include <iostream>

using namespace std;

int main (){

int n,k,c;

k=0;

c=0;

cout<<"n daxil et: ";

cin>>n;

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

if (i%5==0 and i%7!=0){

k++;

c=c+i;

cout<<"Cemi: "<<c<<endl;

cout<<"Sayi: "<<k<<endl;

return 0;

}
4)
#include <iostream>

using namespace std;

int main (){

int n,f,k,c;

cout<<"n daxil et: ";

cin>>n;

k=1;

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

f=1;

c=i;

for (int i=1;i<=c;i++){

f=f*i;

k=k*f;

cout<<k;

return 0;

}
5)
#include <iostream>

using namespace std;

int main (){

double n,s,k;

s=0;

k=0;

cout<<"n daxil et: ";

cin>>n;

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

s=s+i;

k=k+1;

cout<<s/k;

return 0;

}
6)

?
7)
#include <iostream>

using namespace std;

int main (){

int n,f,k,c;

cout<<"n daxil et: ";

cin>>n;

k=0;

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

f=1;

c=i;

for (int c=1;c<=i;c++){

f=f*c;

k=k+f;

cout<<k<<endl;

return 0;

}
8)
#include <iostream>

using namespace std;

int main (){

double s;

s=0.0;

for (int i=1;i<=81;i++){

s=s+(1.0/(i*(i+1)*(i+2)));

cout<<s;

return 0;

}
9)
#include <iostream>

using namespace std;

int main (){

int h;

h=1;

for (int i=2;i<=92;i=i+2){

h=h*i;

cout<<h;

return 0;

}
10)
#include <iostream>

using namespace std;

int main (){

int h;

h=1;

for (int i=1;i<=91;i=i+2){

h=h*i;

cout<<h;

return 0;

}
11)
#include <iostream>

using namespace std;

int main (){

int f,k,c;

k=0;

for (int i=1;i<=15;i++){

f=1;

c=i;

for (int c=1;c<=i;c++){

f=f*c;

k=k+f;

cout<<k<<endl;

return 0;

}
12)
#include <iostream>

#include<cmath>

using namespace std;

int main (){

double f,k,c,x;

k=0.0;

cin>>x;

for (int i=1;i<=10;i++){

f=1;

c=i;

for (int c=1;c<=i;c++){

f=f*c;

k=k+(pow(x,i)/f);

cout<<k<<endl;

return 0;

}
13)
#include <iostream>

#include<cmath>

using namespace std;

int main (){

double y,x;

y=0.0;

cin>>x;

for (int i=1;i<=15;i++){

y=y+sin(pow(x,i));

cout<<y;

return 0;

}
14)
#include <iostream>

#include<cmath>

using namespace std;

int main (){

double S;

S=0.0;

for (int i=1;i<=10;i++){

S=S+pow(3,i);

cout<<S;

return 0;

}
15)
#include <iostream>

#include<cmath>

using namespace std;

int main (){

double S,a;

S=0.0;

cin>>a;

for (int i=1;i<=10;i++){

S=S+pow(a,i);

cout<<S;

return 0;

}
16)
#include <iostream>

#include<cmath>

using namespace std;

int main (){

double S;

S=0.0;

for (int i=3;i<=101;i=i+2){

S=S+1/i;

cout<<S;

return 0;

You might also like