Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Sherova Nilufar
- //№1
- {
- console.log("№1");
- let a=20, b = 15;
- if(a>b){
- console.log("max is a ");
- }
- else if(b>a){
- console.log("max is b");
- }
- else if(a===b){
- console.log("Нет максимального элемента, а и b ровны!");
- }
- }
- //№2
- {
- console.log("/------------------/ \n №2");
- let age = 2007;
- if(((age%4)==0) && ((age%100!=0) || (age%400)==0)){
- console.log("Данный год является высокосным");
- }
- else if(age % 4) {
- console.log("Данный год не высокосный");
- }
- }
- //№3
- {
- console.log("/------------------/ \n №3");
- let a = 1, b = 3, c = 2;
- let d;
- d = b*b - 4*a*c;
- if(d>0){
- let x1, x2;
- x1 = ((-1)*b - Math.sqrt(d))/2*a;
- x2 = ((-1)*b + Math.sqrt(d))/2*a;
- console.log("x1 -> " + x1 + " x2 -> " + x2);
- }
- else if(d==0){
- let x;
- x = ((-1)*b)/2*a;
- }
- else if(d<0){
- console.log("Данное уравнение не имеет вещественных корней!");
- }
- }
- //№4
- {
- console.log("/------------------/ \n №4");
- let a = 4, b = 5, c = 6;
- if((a>b) && (a>c)){
- console.log("max is a");
- }
- else if((b>a) && (b>c)){
- console.log("max is b");
- }
- else if((c>a) && (c>b)){
- console.log("max is c");
- }
- else if((c===b) && (c>a)){
- console.log("max is b and c, they are equal!");
- }
- else if ((b===a) && (b>c)){
- console.log("max is b and a, they are equal!");
- }
- else if((a===c) && (a>b)){
- console.log("max is a and c, they are aqual!");
- }
- else if((a===b) && (b===c)){
- console.log("All variables are equal!");
- }
- }
- //№5
- {console.log("/------------------/ \n №5");
- let x= -1, y = 2, M;
- M = 3*x + y + 1;
- if(M===0){
- console.log("Данная точка лежит на прямой!");
- }
- else{
- console.log("Данная прямая не лежит на прямой!");
- }
- }
- //№6
- {
- console.log("/------------------/ \n №6");
- let a = 3, b = 4, c = 8;
- if((a+b)>c && (b+c)>a && (a+c)>b){
- console.log("Да");
- }
- else{
- console.log("Нет");
- }
- }
- //№7
- {
- console.log("/------------------/ \n №7");
- let purchase1 = 500, purchase2 = 60000, purchase3 = 2500, x;
- if((purchase1 >=1000) && (purchase1<3000)){
- x = (15*a)/100;
- console.log("Сумма вашей покупки №1: " + purchase1);
- console.log("Ваш кэшбэк от покупки №1: " + x );
- }
- else if ((purchase1 >= 3000)){
- x = (10*purchase1)/100;
- if(x>3000){
- x = 3000;
- }
- console.log("Сумма вашей покупки №1: " + purchase1);
- console.log("Ваш кэшбэк от покупки №1: " + x );
- }
- else {
- x = (5*purchase1)/100;
- console.log("Сумма вашей покупки №1: " + purchase1);
- console.log("Ваш кэшбэк от покупки №1: " + x );
- }
- if((purchase2 >=1000) && (purchase2<3000)){
- x = (15*a)/100;
- console.log("Сумма вашей покупки №2: " + purchase2);
- console.log("Ваш кэшбэк от покупки №2: " + x );
- }
- else if ((purchase2 >= 3000)){
- x = (10*purchase2)/100;
- if(x>3000){
- x = 3000;
- }
- console.log("Сумма вашей покупки №2: " + purchase2);
- console.log("Ваш кэшбэк от покупки №2: " + x );
- }
- else {
- x = (5*purchase2)/100;
- console.log("Сумма вашей покупки №2: " + purchase2);
- console.log("Ваш кэшбэк от покупки №2: " + x );
- }
- if((purchase3 >=1000) && (purchase3<3000)){
- x = (15*purchase3)/100;
- console.log("Сумма вашей покупки №3: " + purchase3);
- console.log("Ваш кэшбэк от покупки №3: " + x );
- }
- else if ((purchase3 >= 3000)){
- x = (10*purchase3)/100;
- if(x>3000){
- x = 3000;
- }
- console.log("Сумма вашей покупки №3: " + purchase3);
- console.log("Ваш кэшбэк от покупки №3: " + x );
- }
- else {
- x = (5*purchase3)/100;
- console.log("Сумма вашей покупки №3: " + purchase3);
- console.log("Ваш кэшбэк от покупки №3: " + x );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement