Playing With Characters

Sort by

recency

|

873 Discussions

|

  • + 0 comments

    here is my approach:

    include

    int main() { char ch; char s[20]; char sen[50];

    scanf("%c", &ch);          
    scanf("%s", s);            
    getchar();                 
    fgets(sen, sizeof(sen), stdin); 
    
    printf("%c\n%s\n%s", ch, s, sen);
    

    }

  • + 0 comments

    include

    include

    include

    include

    int main() { char ch; char str[100]; char sentence[100]; scanf("%c",&ch); scanf("%s",str); scanf("\n"); scanf("%[^\n]%*c",sentence);

    printf("%c\n",ch);
    printf("%s\n",str);
    printf("%s\n",sentence);
    
    
    return 0;
    

    }

  • + 0 comments

    here is my approach:

    char ch; char s[100]; char sen[100]; scanf("%c\n",&ch); scanf("%s",s); // scanf("\n"); scanf("\n %[^\n]%*c",sen);

  • + 0 comments

    Here is HackerRank Playing with Characters solution in C

  • + 0 comments
    #include <stdio.h>
    #include <string.h>
    #include <math.h>
    #include <stdlib.h>
    
    int main() 
    {
        char ch,s[100],sen[100];
        scanf("%c\n%s\n%[^\n]s",&ch,s,sen);
        printf("%c\n%s\n%s",ch,s,sen);
        return 0;
    }