Lisaveta777

Which one?

Aug 24th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. //which one is preferable form to use?
  2. //that's the first one
  3.  
  4.               do //makes sure that scanf puts float into temp
  5.                 {
  6.                     printf("How much of artishoks do you want?\n");
  7.                     sc_res= scanf("%f",&temp);
  8.                     if(!sc_res)
  9.                         scanf("%*s");
  10.  
  11.                 }while(!sc_res);
  12.  
  13. //that's the second one
  14.  
  15.                 printf("How much of artishoks do you want?\n");
  16.                 sc_res= scanf("%f",&temp);
  17.  
  18.                 while(!sc_res) //makes sure that scanf puts float into temp
  19.                 {
  20.                     scanf("%*s");
  21.                     printf("How much of artishoks do you want?\n");
  22.                     sc_res= scanf("%f",&temp);
  23.  
  24.                 }
Advertisement
Add Comment
Please, Sign In to add comment