Horje
check if the c code is a palindrome Code Example
check if the c code is a palindrome
#include <stdio.h>
#include <string.h>

int main(){
    char string1[20];
    int i, length;
    int flag = 0;
    
    printf("Enter a string:");
    scanf("%s", string1);
    
    length = strlen(string1);
    
    for(i=0;i < length ;i++){
        if(string1[i] != string1[length-i-1]){
            flag = 1;
            break;
   }
}
    
    if (flag) {
        printf("%s is not a palindrome", string1);
    }    
    else {
        printf("%s is a palindrome", string1);
    }
    return 0;
}




C

Related
input value from terminal to c Code Example input value from terminal to c Code Example
Mongo connect db Code Example Mongo connect db Code Example
c include delay Code Example c include delay Code Example
php disable html errors Code Example php disable html errors Code Example
declaring array in dart Code Example declaring array in dart Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8