🔥C - Operator Precedence (Operator Priority) 2.1 🔥🔥🔥Control Instruction 🔥

 

//Here we are Learning the Operator Presedence in simple language priority of operator in C
// In C language the most Prority Gives to

// Most Priority           < *, % , / >
// Second Priority          < +, - >
// Third Priority            < = >

// after that id if divide and multiplication comes together then it become tie situation in both operator so for that we use4
//  the associative proerty by giving Bracket at right position

#include <stdio.h>

int main()
{
    int x = 2y = 4;
    printf("Here is the value of 3*x + 2*y = %d\n"3 * x + 2 * y);
    printf("Here is the value of 3*x / 2*y = %d\n", (3 * x) / (2 * y) + 1);
    return 0;
}

csd

#include <stdio.h>

main() {

   int a = 20;
   int b = 10;
   int c = 15;
   int d = 5;
   int e;
 
   e = (a + b) * c / d;      // ( 30 * 15 ) / 5
   printf("Value of (a + b) * c / d is : %d\n",  e );

   e = ((a + b) * c) / d;    // (30 * 15 ) / 5
   printf("Value of ((a + b) * c) / d is  : %d\n" ,  e );

   e = (a + b) * (c / d);   // (30) * (15/5)
   printf("Value of (a + b) * (c / d) is  : %d\n",  e );

   e = a + (b * c) / d;     //  20 + (150/5)
   printf("Value of a + (b * c) / d is  : %d\n" ,  e );
  
   return 0;
}

   Control Instruction:-

There are four types of Control Instruction which gives the flow of data in whole program


1. Sequence Control Instruction. {Just Line by compilation}

2. Decision Control Instruction  {If and else etc}

3. Loop Control Instruction.  {For and dowhile etc}

4. Case Control Instruction {Switch case}







Comments

Popular Posts