This computer science problem involves algorithmic thinking and programming concepts. The solution below explains the approach, logic, and implementation step by step.

ScanSolve AI Answer
2 stepsYes, there are a couple of errors in the C program.
The main issue is a consistent misspelling of the variable principal.
Incorrect variable name in scanf for principal:
You declared the variable as float principal; but then tried to read input into &principalAmt in the scanf function. The variable principalAmt is not declared. It should be &principal.
Original:
scanf("%f", &principalAmt);
Corrected:
scanf("%f", &principal);
Incorrect variable name in simple interest calculation:
Similarly, in the calculation for SI, you used principleAmt instead of principal.
Original:
SI = (principleAmt * time * rate) / 100;
Corrected:
SI = (principal * time * rate) / 100;
Here is the corrected code:
#include<stdio.h>
int main() {
float principal;
float rate;
float time;
float SI;
printf("ENTER THE PRINCIPLE AMT\n");
scanf("%f", &principal); // Corrected: used 'principal'
printf("ENTER THE RATE\n");
scanf("%f", &rate);
printf("ENTER THE TIME\n");
scanf("%f", &time);
//calculate the simple interest
SI = (principal * time * rate) / 100; // Corrected: used 'principal'
//display the calculated interest to the user
printf("INTEREST:%f\n", SI);
return 0;
}
Get instant step-by-step solutions to any question. Free to start.
Ask Your QuestionStill have questions?
Yes, there are a couple of errors in the C program. The main issue is a consistent misspelling of the variable principal.
This computer science problem involves algorithmic thinking and programming concepts. The solution below explains the approach, logic, and implementation step by step.