fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. char another;
  5. int num;
  6. do
  7. {
  8. printf("Enter a number\t");
  9. scanf("%d",& num);
  10. printf("The square of %d\n",num,num*num);
  11. printf("Do you want to enter another number y/n \t");
  12. fflush(stdin);
  13. scanf("%c",&another);
  14. }while(another=='y');
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5536KB
stdin
4
stdout
Enter a number	The square of 4
Do you want to enter another number y/n