Tuesday 30 August 2016

Solution of URI 2160 :: Name at Form


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>

int main()
{
    char name[600];
    gets(name);
    printf((strlen(name)>80)?"NO\n":"YES\n");
    return 0;
}

5 comments:

  1. Hi i would like to know why am i getting WA(30%) on my solution can't find the mistake

    #include
    #include

    int main(){

    char L[500];
    int i;

    gets(L);

    i = strlen(L);

    if(i < 80){
    printf("YES\n");
    }
    else{
    printf("NO\n");
    }

    return 0;
    }

    ReplyDelete
  2. why we used 600 range in character?

    ReplyDelete
  3. #include
    #define MAX 500
    int main()
    {
    char ch[500];
    int n;

    gets(ch);

    n = strlen(ch);

    if(n>80) printf("NO\n");
    else printf("YES\n");

    return 0;
    }
    //how it is runtime error?

    ReplyDelete
  4. why it is not working with scanf function

    ReplyDelete

Note: only a member of this blog may post a comment.