Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

program to read name using string

 #include<stdio.h>

#include <string.h>


    int main(){


    char name[5];

   

     

    printf("enter your name\n");

    scanf("%s",name);


    if ( strlen (name) > 5)

    {

        printf("please enter only 5 character name\n");

    }

    else if ( strlen (name) <= 5)

    {


    printf("--------------------------------------------------------------------------------------------------\n");


    printf("your name is %s",name);

    }


    return 0;

}


Post a Comment

0 Comments