display | more...
Everyone knows that Weetos are the choco-hoops of choice for today's distinguished gentleman. However, everyone also knows that old Joe McShmoe down the street can go to town in his Joemobile and get himself some Weetos too! It is blindingly clear that we need a way to differentiate between cool guys like you and bums like Joe.

I have such a way.*

In this very writeup, I present to you the codiest C code that will make you stand out from the rest when you are enjoying your morning dose of choco nutrients! In order to use this code effectively, you need to know the rules of the Game.

The Game

The Game is very simple: get some Weetos, and munch away. Once you are down to a countably small number of Weetos, the Game begins. First eat one Weeto. Then two at a time. Then three, and so on, until you have run out of Weetos. The aim of the game is to get a "Perfect!" as deemed by the program, which means that on your last spoonful, you will finish your bowl by eating exactly the number of Weetos that you are supposed to (e.g. if your last spoonful was 4, and there are 5 left, you get a "Perfect!"). Non-Perfect scores are punishable by death, or a re-match. The program will also tell you what the maximum number of Weetos on your spoon will be, and the number on your last spoonful.

Give me the Code. Also, shut up

Use it wisely!

#include <stdio.h>

int main ()
{
  int have, need;

  printf("Please enter the number of remaining Weetos and don't cry about it: \n");
  scanf("%d", &have);

  need = 0;
	
  while(have>0)
  {
    need++;                     /* Number needed */
    have = have - need;   /* Eat number of Weetos needed */
  }

  if(have >= 0)
  {
    printf("Need = %d\t Have = %d\n", need, have);

    if(need == have)
    {
      printf("Perfect! The largest, and last, spoonful will have %d Weetos.\n", need);
    }

    else if(need > have)
    {
      if(need==1)
      {
        printf("The largest spoonful will have %d Weeto, and the last spoonful will have %d Weetos. \n", need, have+need);
      }	
      else
      {
      printf("The largest spoonful will have %d Weetos, and the last spoonful will have %d Weetos. \n", need, have+need);
      }
    }
  }
	
  else
  {
    if(need<=2)
    {
      printf("The largest spoonful will have %d Weeto, and the last spoonful will have %d Weeto.\n", need-1, have+need);
    }		
    else
    {
      printf("The largest spoonful will have %d Weetos, and the last spoonful will have %d Weetos.\n", need-1, have+need);
    }
  }	
exit(0);
}

*Gauri taught me how to play.

Log in or register to write something here or to contact authors.