Skip to content

Instantly share code, notes, and snippets.

@anonur
Last active April 4, 2019 19:06
Show Gist options
  • Select an option

  • Save anonur/23cd0d52883feb60cdecb52729db5f51 to your computer and use it in GitHub Desktop.

Select an option

Save anonur/23cd0d52883feb60cdecb52729db5f51 to your computer and use it in GitHub Desktop.
Sums integers while user enters 0
#include<stdio.h>
int main()
{
int x;
printf("Enter a one digit integer: ");
scanf("%d",&x);
switch(x)
{
case 1: printf("\nOne.");break;
case 2: printf("\nTwo.");break;
case 3: printf("\nThree.");break;
case 4: printf("\nFour.");break;
case 5: printf("\nFive.");break;
case 6: printf("\nSix.");break;
case 7: printf("\nSeven.");break;
case 8: printf("\nEight.");break;
case 9: printf ("\nNine.");break;
default: printf("\nThis integer isn't one digit...");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment