int pertambahan(int pilihan, int now){  int result;  result =pilihan + now;  return result; } int perkalian(int pilihan, int now){  int result;  result = pilihan*now;  return result; } int main(){       int NoR,initial;  int now;  int temp1, temp2;      scanf("%d %d", &NoR, &initial);  getchar();  now=initial;  for(int o=0;o=-1000 && pilihan1<=1000)            {                temp1 = pertambahan(pilihan1,now);            }            else{                    temp1=-10000;                  }   }      else if(a=='x')   {            if(pilihan1>=-2 && pilihan1<=2){            temp1 = perkalian(pilihan1,now);   }    else            {            temp1=-10000;            }   }      if(b=='+')   {     if(pilihan2>=-1000 && pilihan2<=1000)     {     temp2 = pertambahan(pilihan2,now);        }        else            {            temp2=-10000;            }    }      else if(b=='x')   {    if(pilihan2>=-2 && pilihan2<=2)            {            temp2 = perkalian(pilihan2,now);           }    else            {            temp2=-10000;            }   }      if(temp1>temp2)           {            now=temp1;           }               else                   {                    now=temp2;                   }  }  printf("%d\n", now);    return 0;   } Can u give general explaination for this code, so i can learn it. pertambahan = Addition. perkalian= multiplication. plihan= choice.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

int pertambahan(int pilihan, int now){
 int result;
 result =pilihan + now;
 return result;
}

int perkalian(int pilihan, int now){
 int result;
 result = pilihan*now;
 return result;
}

int main(){
    
 int NoR,initial;
 int now;
 int temp1, temp2;
 
 
 scanf("%d %d", &NoR, &initial);
 getchar();
 now=initial;


 for(int o=0;o<NoR;o++){
  char a,b;
  int pilihan1,pilihan2;
  scanf("%c %d %c %d",&a, &pilihan1,&b, &pilihan2);
  getchar();
  
  if(a=='+')
  {
   if(pilihan1>=-1000 && pilihan1<=1000)
           {
               temp1 = pertambahan(pilihan1,now);
           }
           else{
                   temp1=-10000;
                 }
  }
  
  else if(a=='x')
  {
           if(pilihan1>=-2 && pilihan1<=2){
           temp1 = perkalian(pilihan1,now);
  }
   else
           {
           temp1=-10000;
           }
  }
  
  if(b=='+')
  {
    if(pilihan2>=-1000 && pilihan2<=1000)
    {
    temp2 = pertambahan(pilihan2,now);
       }
       else
           {
           temp2=-10000;
           } 
  }
  
  else if(b=='x')
  {
   if(pilihan2>=-2 && pilihan2<=2)
           {
           temp2 = perkalian(pilihan2,now);
          }
   else
           {
           temp2=-10000;
           }
  }
  
  if(temp1>temp2)
          {
           now=temp1;
          }
              else
                  {
                   now=temp2;
                  }
 }
 printf("%d\n", now);
 
 return 0;
 
}

Can u give general explaination for this code, so i can learn it.
pertambahan = Addition.

perkalian= multiplication.

plihan= choice.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education