Monday, October 19, 2020

c program of salary net pay with discount

First Method:

#include <stdio.h>

int main() {

    float n, d, np;

    printf("Enter a number:");

    scanf("%f", &n);

    d = n * 0.10;

    np = n - d;

    printf("Pay Rs = %.2f", np);

    return 0;

}


Second Method:

#include <stdio.h>

int main() {

    float np;

    printf("Enter a number:");

    scanf("%f", &np);

    np = np - (np * 0.10);

    printf("Pay Rs = %.2f", np);

    return 0;

}


Third Method:

#include <stdio.h>

int main() {

    float np;

    printf("Enter a number:");

    scanf("%f", &np);

    printf("Pay Rs = %.2f, np * 0.9);

    return 0;

}

No comments:

Post a Comment

How to Fight Overthinking or Negative Thoughts?

How to Combat Overthinking or Negative Thoughts? 1. Don’t Fight Your Thoughts Trying to suppress or control negative thoughts often backfire...