Hello -- this is for intro to programming with c. I have tried to fix the two er
ID: 670055 • Letter: H
Question
Hello -- this is for intro to programming with c. I have tried to fix the two errors I keep getting in Codeblocks when I compile this, but I have NO idea what is wrong. My assignment is due tonight at 11 PM EST, 8 PM PST. I desperately need someone to tell me how to fix this so this program will run! Please let me know if you need other info, below is the text file:
#include <stdio.h>
int main(void){
//Prompt user to enter the starting values
int start,end,i,j;
printf("Enter a starting value between 1 and 99: ");
scanf("%d",&start);
printf("Enter an ending value between 1 and 99: ");
scanf("&d",&end);
for(i=start; i<=end; i++)
printf("%d",i);
printf(" ");
if(start>=1 && end<=99);{
for(i=start;i<=end;i++){
printf("%d",i);
(for j=start; j<=end;j++);
printf("%d",i*j);
printf(" ");
}
}
else if((start<1 || start>99)&&(end<1 || end>99)){
printf("Both values are out of range");
}
else if((start<1 || start>99)){
printf("Start value is out of range");
}
else if((end<1 || end>99)){
printf("End value is out of range");
}
system("pause");
return 0;
}
Explanation / Answer
#include<stdio.h>
int main(void){
//Prompt user to enter the starting values
int start,end,i,j;
printf("Enter a starting value between 1 and 99: ");
scanf("%d",&start);
printf("Enter an ending value between 1 and 99: ");
scanf("%d",&end);
for(i=start; i<=end; i++)
printf("%d",i);
printf(" ");
if(start>=1 && end<=99)
{
for(i=start;i<=end;i++){
printf("%d",i);
for (j=start; j<=end;j++)
{
printf("%d",i*j);
printf(" ");
}
}
}
else if((start<1 || start>99)&&(end<1 || end>99))
{
printf("Both values are out of range");
}
else if((start<1 || start>99))
{
printf("Start value is out of range");
}
else if((end<1 || end>99))
{
printf("End value is out of range");
}
//system("pause");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.