Question Authors' Forum

Skipping of printf statement in expected output

Skipping of printf statement in expected output

by Vandana Naik -
Number of replies: 1
Consider the following program:

  1. #include < stdio.h >   
  2. #include < conio.h > 
  3. #define PI 3.141  
  4. int main()   
  5. {  
  6.     float radius, area;  
  7.     printf("Enter radius of circle\n");  
  8.     scanf("%f", & radius);  
  9.     area = PI * radius * radius;  
  10.     printf("Area of circle : %f\n", area);  
  11.     getch();  
  12.     return 0;  
  13. }  
When I use this program in answer and put test cases, line number 7 comes in expected output, is there any way to skip it, other than removing it altogether from the program.
In reply to Vandana Naik

Re: Skipping of printf statement in expected output

by Richard Lobb -

No, there's no way that CodeRunner can distinguish the printf that does the prompting from the one that does the output. You either have to tell students not to issue a prompt or explain to them how the output from CodeRunner differs from what they see on the terminal due to the automatic echoing of typed input (which doesn't happen when the same input is being read from a file).