class HelloWorld {
public static void main(String[] args) {
// shart operatori 11 misol
int a = 45, b=13;
if(a != b){
a = (a > b)?a:b;
b = a;
}
else{
a = 0;
b = 0;
}
System.out.println("a = "+a+" b = "+b);
}
}
class HelloWorld {
public static void main(String[] args) {
// shart operatori 26 misol
int x = 5,fx;
if(x <= 0){
fx = -1*x;
}
if(0fx=x*x;
}
else{
fx = 4;
}
System.out.println("fx = "+fx);
}
}
class HelloWorld {
public static void main(String[] args) {
// takrorlash operatori 11 misol
int n = 2,result=0;
for(int i=0;i<=n;i++){
result+=Math.pow(n+i,3);
}
System.out.println("result = "+result);
}
}
class HelloWorld {
public static void main(String[] args) {
// takrorlash operatori 26
double result=0,x = 0.5;
int n = 2;
for(int i=1;i<=n;i+=2*n-1){
result += Math.pow(-1,n-1)*Math.pow(x,i)/i;
}
System.out.println("result = "+result);
}
}
Do'stlaringiz bilan baham: |