<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2.  
  3. /*
  4. START
  5.  
  6. User needs to write the kind of pokemons and two inputs first input is  pokemons and second input is candy
  7.  
  8. IF the input of  candy is less than 12
  9.  
  10. THEN
  11.  
  12. Display error
  13.  
  14. ELSE
  15.  
  16. IF the user writes less than two inputs
  17.  
  18. Display please write two inputs
  19.  
  20. END IF
  21.  
  22. Candy Evolutions = Candy/12
  23.  
  24. IF the number of evolutions from Candy is less than the number of Pidgeys
  25.  
  26. THEN
  27.  
  28. The total number of evolutions is equal to the number of evolutions from candy
  29.  
  30. ELSE
  31.  
  32. The total number of evolutions is equal to the number of Pidgeys
  33.  
  34. END IF
  35.  
  36. XP = number of evolutions x 1000
  37.  
  38. Display the total number of Evolutions possible and the XP gained
  39.  
  40. END
  41.  
  42. */
  43.  
  44.  
  45.  
  46.  
  47. int main( void )
  48. {
  49.  
  50. char kind; //for save the input
  51.  
  52. int pokemon, candy;//for save the input
  53.  
  54. int n;//for save the input
  55.  
  56. int evolution, xp, evolutionfromcandy;//save the intger for used the calcuator
  57.  
  58. while (3) {//this loop for display massage if missing input
  59. n=scanf ( "%c %d %d", &kind,&pokemon, &candy );//the inputs from the user
  60. if (n!=3)
  61. {
  62. printf (" missing input");
  63. return;}
  64. break;}
  65.  
  66.  
  67. if ( ( pokemon < 1 )||(candy<12))//if the input of pidgeys or candy less than the order
  68.  
  69. {
  70. printf (" please write a number");//print for the user if there wrong
  71.  return;}//becouse that dose not print the other print
  72.  
  73.  
  74.  
  75.  
  76.  if ((  kind != 'p'  )&&(  kind != 'r' )&&( kind != 'z' ) )//display erorr massage if out of kinds
  77. {
  78. printf (" the kinds are Pidgeys,Rattata or Zubat ");//print the erorr if there other input
  79. return; }
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. if (kind=='p')//for the programming understand witch kind is used
  88. {
  89.  
  90.  
  91. evolutionfromcandy=candy/12;//the number of the evolution efter divide by one evolution every Pidgeys
  92.  
  93. }
  94.  
  95.  if (kind=='r')//for the programming understand witch kind is used
  96.  
  97. {
  98.  evolutionfromcandy=candy/25;//the number of the evolution efter divide by one evolution every Rattata
  99. }
  100.  
  101.  if (kind=='z')//for the programming understand witch kind is used
  102.  
  103. {
  104.     evolutionfromcandy=candy/50;//the number of the evolution efter divide by one evolution every Zubat
  105. }
  106.  
  107. if  (evolutionfromcandy < pokemon) //if the evolution efter divided less than pokemon
  108.  
  109.  {
  110.   evolution  = evolutionfromcandy;//the number of the evolution after divided
  111.  }
  112.  
  113.  
  114.  
  115. else
  116.  {
  117.    evolution = pokemon;//evolution equal of the number of pokemon
  118.    }
  119.  
  120.  
  121. xp = evolution *  1000;
  122. {
  123.  
  124. printf ("the total number of Evolution is %d", evolution);//display the evolution
  125.  
  126. printf ("\n\tthe total number of xp is %d", xp);//display the xp
  127.  
  128. }
  129.  
  130. }