This is a mock exam question im working on. I have to make the code for the flowchart attached. My first solution involved 2 if loops but from help I got on another forum I realised it wasnt correct to do it that way as it didnt loop.
Below is the code that I currently have. Can someone please tell me if this is a correct solution for the attached flowchart?:
#include <stdio.h>
int main(void)
{
int i=0;
char c=0;
char line[10]="Fantastic";
while(i < 10)
{
if (c == '\0')
{
printf("\n");
}
else
{
printf("%c",c);
c=line[i++];
}
printf("\n");
return 0;
}


Sign In
Create Account



Back to top










