Hi, I'm having trouble with this. Is there something wrong with my code line or should i just redo everything?
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main()
{
string text = get_string("Text: ");
int letters = 0;
int words = 1;
int sentences = 0;
for (int i = 0; 1 < strlen(text); i++)
{
if (isalpha(text[i]))
{
letters++;
}
else if (text[i] == ' ')
{
words++;
}
else if (text[i] == '.' || text[i] == '?' || text[i] == '!')
{
sentences++;
}
}
float L = (float) letters / (float) words * 100;
float S = (float) sentences / (float) words * 100;
float calculation = (0.0588 * L- 0.296 * S -15.8);
int index = round(calculation);
if (index < 1)
{
printf("Before Grade 1\n");
}
else if (index > 16)
{
printf("Grade 16+\n");
}
else
{
printf("Grade %.of\n", index);
}
return 0;
}