Write a C-program to calculate simple interest with following condtions?

Write a C-program to calculate simple interest with following condtions

1. Amount should not be Negative and should not be greaterthen 10000
2. Duration should not be Negative and should not be greaterthen 24
3. Interest should not be Negative and should not be greaterthen 10


#include <stdio.h>

int main() {
    int a,d,i,si;
    printf("Enter Amount");
    scanf("%d",&a);
    printf("Enter Duration");
    scanf("%d",&d);
    printf("Enter Interest");
    scanf("%d",&i);
    if(a>=0 && a<=10000 && d>=0 && d<=24 && i>=0 && i<=10)
    {
       si=a*d*i/100;
       printf("Simple Interest is %d",si);
    }
    else
    {
         printf("Please Enter Valid Numbers");
    }
    
    return 0;
}

Output:

Enter Amount 2000
Enter Duration 2
Enter Interest 2
Simple Interest is 80




More Programs


35 . Write a C-program to calculate simple interest with following condtions
36 . Write a C-program to print age
37 . Write a C-program to print max number among three numbers
38 . Write a C-program to print 1 to 10 values using for loop
39 . Write a C-program to print 10 to 1 values using for loop
40 . Write a C-program to print 1 to n values using for loop
41 . Write a C-program to print even numbers using for loop
42 . Write a C-program to print even number or odd number based on the n value using for loop
43 . Write a C-program to print even number or odd number based on the n value using single for loop
44 . Write a C-program to count the number of divisible numbers in a given range(1-100)
45 . Write a C-program to print count the number of divisible numbers in a given range(1-100) without using loop