S2-C-Programs

All major conceptual S2 C-Programs with Algorithms

View the Project on GitHub trulyPranav/S2-C-Programs

Code:

#include <stdio.h>

void main(){
    char s1[10],s2[10];
    int flag=0;

    printf("Enter the First String:");
    scanf("%s", s1);

    printf("Enter the Second String");
    scanf("%s", s2);

    for(int i=0; s1[i] != '\0' || s2[i] != '\0'; i++){ // i.e, the program must go on until one of the string ends
        if(s1[i] != s2[i]){
            flag = 1;
            break; // Important
        }
    }

    if(flag == 1)
        printf("The strings are not same");
    else
        printf("The strings are same");
}

Algorithm:

Will be updated