Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #define MAX 50
- int main(void){
- char str[MAX] = "0"; //initialise 1st char for the loop
- int i;
- printf("Enter your sentence, at most 50 character: n");
- for(i = 0; str[i] != 'n'; i++){ //terminates upon n
- str[i] = getchar();
- putchar(str[i]);
- }
- return 0;
- }
- #include <stdio.h>
- #include <ctype.h>
- #define MAX 50
- int main(void){
- char str[MAX] = "0"; //initialise 1st char for the loop
- int i;
- printf("Enter your sentence, at most 50 character: n");
- for(i = 0;; i++){ //terminates upon n
- str[i] = getchar();
- putchar(str[i]);
- if(str[i] == 'n')
- break;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment