Wipro NTH Coding Question- 27

One comment on “Wipro NTH Coding Question- 27”


  • chopparapu Gopala krishna

    #include

    #include

    int main()

    {

    char mystring[50];

    int len, i;

    //print a string about the program

    printf(“C Program to reverse a string\n”);

    printf(“Enter a string: “);

    //get the input string from the user

    scanf(“%s”, mystring);

    //find the length of the string using strlen()

    len = strlen(mystring);

    //loop through the string and print it backwards

    for(i=len-1; i>=0; i–){

    printf(“%c”, mystring[i]);

    }

    return 0;

    }