diff --git a/Hello world b/Hello world index 3b7617c..0bfc88b 100644 --- a/Hello world +++ b/Hello world @@ -1,6 +1,7 @@ #include int main() { + //Print function to print hello world printf("Hello, World!"); return 0; } diff --git a/frequency of a character b/frequency of a character index ad51eba..fabb19f 100644 --- a/frequency of a character +++ b/frequency of a character @@ -4,11 +4,15 @@ int main() char str[1000], ch; int i, frequency = 0; print("Enter a string: "); + //Main string gets(str); printf("Enter a character to find the frequency: "); + //Character whose frequency we want to get scanf("%c",&ch); for(i = 0; str[i] != '\0'; ++i) { + //Whenever we are getting the character ch in the string + //we are incrementing the frequency if(ch == str[i]) ++frequency; } diff --git a/length of a string b/length of a string index 810e5cd..c605ef5 100644 --- a/length of a string +++ b/length of a string @@ -4,7 +4,10 @@ int main() char s[1000]; int i; printf("Enter a string: "); + //Our string scanf("%s", s) + //With the help of this loop we are able to count the number of characters in the string + //untill we reach the end for(i = 0; s[i] != '\0'; ++i) printf("Length of string: %d", i);