Identify the Number of Assigned Element in a String

In this tutorial the main goal is to identify the corresponding element based on the input string.

#include <stdio.h>
int main()
{
    //Examination A
    char schl[100];
    int i;
    int c;
    printf("Enter the string: ");
    gets(schl);
    c = strlen(schl);
    for( i=0; i < c; i++)
    {
        printf("Element [%d]: %c\n", i, schl[i] );
    }
return 0;
}
I used the gets function to get string and strlen to get the length of the string and put in to condition.

Output:

Identify the Number of Assigned Element in a String Identify the Number of Assigned Element in a String Reviewed by code-dev on 10:31 PM Rating: 5

No comments:

Powered by Blogger.