[ create a new paste ] login | about

Link: http://codepad.org/b95q7ZwM    [ raw code | output | fork ]

C, pasted on Sep 13:
#include<stdio.h>

int main()

{



int i;



int choice;

char c[2];

printf("please enter your first and last initial : ");

scanf("%s",&c);

fflush(stdin);

printf("\do you want to print first-last or last-first? \n please enter 1 for first-last and enter 2 for last-first \t");

scanf("%d",&choice);

if(choice==1)

{

printf("%c\n%c\n%c%c\n%c%c\n%c%c%c%c\n%c\n%c%c\n%c\n",c[0],c[0],c[0],c[0],c[0],c[0],c[1],c[1],c[1],c[1],c[1],c[1],c[1],c[1]);

}



else

{

printf("%c\n%c\n%c%c\n%c%c\n%c%c%c%c\n%c\n%c%c\n%c\n",c[1],c[1],c[1],c[1],c[1],c[1],c[0],c[0],c[0],c[0],c[0],c[0],c[0],c[0]);

}



}


Output:
1
2
3
4
5
6
7
8
9
10
11
please enter your first and last initial : do you want to print first-last or last-first? 
 please enter 1 for first-last and enter 2 for last-first 	








Exited: ExitFailure 22


Create a new paste based on this one


Comments: