How to use evaluate in c language

program to use evaluate in c language


#include<stdio.h>
int main()
{
    int a, b, c, d, e, f, g, h, k;
    a = 8, b = 4, c = 2, d = 1, e = 5, f = 20;
    printf("%d\t", a + b - (c + d) * 3 % e + f / 9);
    a = 17, b = 5, c = 6, d = 3, e = 5;
    printf("%d\t", a % 6 - b / 2 + (c * d - 5) / e);
    a = 4, b = 5, c = 6, d = 3, e = 5, f = 10;
    printf("%d\t", a * b - c / d < e + f);
    a = 8, b = 5, c = 8, d = 3, e = 65, f = 10, g = 2, h = 5, k = 2;
    printf("%d\t", a - b + c / d == e / f - g + h % k);
    a = 8, b = 3, c = 2, d = 3, e = 2, f = 11;
    printf("%d\n", a - b || (a - b * c) + d && e - f % 3);
    return 0;
}

output


10      5       0       1       1

How to use Continue Statement in JavaScript Program

Program to use Continue Statement JavaScript Language


let a;
let b = 5;
for (a = 0; a <= 10; a++) {

    if (b == a) {
        continue;
    }
    console.log("Number =",a);

}

Output


Number = 0
Number = 1
Number = 2
Number = 3
Number = 4
Number = 6
Number = 7
Number = 8
Number = 9
Number = 10

Steps Description

  1. Declare two variables a and b
  2. Initialize two variables with value of 5 respectively a and b
  3. continue statement works with loop
  4. If the condition is matched in the if statement inside the for loop, the continue statement will not print that condition.
  5. console.log inbuild function to display a variable number

How to use Break Statement in JavaScript Program

Program to use break statement JavaScript Language


let a;
let b = 5;
for (a = 0; a <= 10; a++) {

    if (b == a) {
        break;
    }
    console.log("Number =",a);
}

Output


Number = 0
Number = 1
Number = 2
Number = 3
Number = 4

Steps Description

  1. Declare two variables a and b
  2. Initialize two variables with value of 5 respectively a and b
  3. break statement works with loop
  4. The break statement will break the for loop if the condition in the under if statement of the loop is matched.
  5. console.log inbuild function to display a variable number

How to find Student of Result Total, Average, Grade in JavaScript Program

Program to use Student of Result JavaScript Language


let Math = 57;
let English = 68;
let Computer = 76;
let Total;
let Percentage;
let Grade;

Total = Math + English + Computer;
console.log("Total of Student Number =", Total);

Percentage = Total / 3;
console.log("Percentage of Student Number =", Percentage.toFixed(2));

if (Percentage > 80 && Percentage <= 100) {
    console.log("Grade A+");
}
else if (Percentage > 60 && Percentage < 80) {
    console.log("Grade = A");
}
else if (Percentage > 45 && Percentage <= 60) {
    console.log("Grade = B");
}
else if (Percentage > 33 && Percentage < 45) {
    console.log("Grade = C");
}
else if (Percentage > 0 && Percentage < 33) {
    console.log("Grade = F");
}

Output


Total of Student Number = 201
Percentage of Student Number = 67.00
Grade = A

Steps Description

  1. Declare six variables Math, English, Computer, Total, Percentage and Grade
  2. Initialize six variables with value of 57, 68, 76 respectively Math=57, English=68, Computer=76, Total, Percentage and Grade
  3. Variable math, variable english and variable computer are three variables which are added with the help of addition operator.
  4. Three variables add value to total variable with the help of assignment operator
  5. Percentage = (assignment operator) variable Total / (division operator) 3;
  6. if statement Percentage > 80 && Percentage <= 100 display Grade A+
  7. else if statement Percentage > 60 && Percentage < 80 display Grade A
  8. else if statement Percentage > 45 && Percentage < 60 display Grade B
  9. else if statement Percentage > 33 && Percentage < 45 display Grade C
  10. else if statement Percentage > 0 && Percentage < 33 display Grade F
  11. console.log inbuild function to display Total variable number Percentage variable number and Grade variable alphabet

How to use conversion in assignment in c language

program to use conversion in assignment in c language


#include<stdio.h>
int main()
{
    char c1,c2;
    int i1,i2;
    float f1,f2;
    c1='H';
    i1=80.56; 
    f1=12.6;
    c2=i1;
    i2=f1;
    printf("c2=%c, i2=%d\n",c2,i2);
    f2=i1;
    i2=c1;
    printf("f2=%.2f, i2=%d\n",f2,i2);
    return 0;
}

output


c2=P, i2=12
f2=80.00, i2=72

How to find even or odd number in C Language

Program to use even or odd number in C Language


#include <stdio.h>
int main()
{
    int num;
    printf("enter a number : ");
    scanf("%d", &num);
    if (num % 2 == 0)
    {
        printf("number is even\n");
    }
    else
    {
        printf("number is odd\n");
        num *= 2;
        printf("now the number is %d\n", num);
    }
    return 0;
}

output


enter a number : 13
number is odd
now  the number is 26

Steps / Description

  1. Declare integer variable num
  2. printf inbuild function to display enter variable a number
  3. The value you will put in scanf
  4. Going into the if statement will divide by 2
  5. printf inbuild function to display if divided by two then even
  6. else statement
  7. printf inbuild function to display if not divided by two then it will be
    odd
  8. The given value will be multiplied by two
  9. printf inbuild function to display the value given in num will be printed

How to use ternary operator in c language

program to use ternary operator in c language


#include<stdio.h>
int main()
{
    int y,z,max;
    printf("Enter values for y and z : ");
    scanf("%d%d",&y,&z);
    max = z>y ? y : z;
    printf("larger of %d and %d is %d\n",y,z,max);
    return 0;
}

output


Enter a values for y and z : 12
4
larger of 12 and 4 is 12

Steps Description

  1. Declare integer three variable y , z and max
  2. printf inbuild function to display value of variable y and z with respective decimal placeholder %d
  3. Evaluation of variable y and z to determine greater than z
  4. Assign max variable with greater than variable y
  5. printf inbuild function to display larger value of variable y

How to use relational operators in c language

program to use relational operators in c language


#include<stdio.h>
int main()
{
    int x,y;
    printf("Enter values for x and y : ");
    scanf("%d%d",&x,&y);
    if(x<y)
    printf("%d is less than %d\n",x,y);
    if(x<=y)
    printf("%d is less than or equal to %d\n",x,y);
    if(x==y)
    printf("%d is equal to %d\n",x,y);
    if(x!=y)
    printf("%d is not equal to %d\n",x,y);
    if(x>y)
    printf("%d is greater than %d\n",x,y);
    if(x>=y)
    printf("%d is greater than or equal to %d\n",x,y);
    return 0;
}

output


Enter values for a and b : 25
20
25 is not equal to 20
25 is greater than or equal to 20

Steps Description

  1. Declare integer variable x and y
  2. printf inbuild function to display value of variable x and y with respective decimal placeholder %d
  3. Evaluation of variable x and variable y to determine if a is less than b
  4. printf inbuild function to display value of variable x and y only when value of x is less than value of y
  5. Evaluation of variable x and variable y to determine if x is less than equal y
  6. printf inbuild function to display value of variable x and y only when of x is less than or equal to
  7. Evaluation of variable x and variable y to determine if x is equal y not
  8. printf inbuild function to display value of variable x and variable y only when of x is equal to y
  9. Evaluation of variable x and variable y to determine if not equal
  10. printf inbuild function to display value of variable x and variable y only when value of x is not equal to
  11. Evaluation of variable x and variable y to determine if greater than y
  12. printf inbuild function to display value of x is greater than y only when value of y is
  13. Evaluation of variable x and variable y to determine if x greater than or equal to
  14. printf inbuild function to display value of x only when value of x is greater than or equal to

How to use postfix Increment and decrement in c language

program to use postfix Increment and decrement in c language


#include<stdio.h>
int main()
{
    int s=10;
    printf("s=%d\t",s);
    printf("s=%d\t",s++);
    printf("s=%d\t",s);
    printf("s=%d\t",s--);
    printf("s=%d\n",s);
    return 0;
}

output


s=10     s=10     s=11     s=11     s=10 

Steps Description

  1. Declare integer variable S=10
  2. Initialize in integer variable S=10
  3. printf inbuild function to display value of variable S in decimal place holder %d S = 10
    for formatting tab separator \t is used
  4. printf inbuild function to display postfix increment values variable S in decimal
    place holder %d S = 10 for formatting tab separator \t is used
  5. printf inbuild function to display value of variable S in decimal place holder %d S = 11
    for formatting tab separator \t is used
  6. printf inbuild function to display post decrement values variable S in decimal place holder %d S = 11 for formatting tab separator \t is used
  7. printf inbuild function to display value of variable S in decimal place holder %d S = 10
    for formatting tab separator \t is used