Pages

Thursday, 8 November 2012

WAP to to enter a string and Print the consecutive character.

  • WAP to to enter a string and Print the consecutive character.

INPUT:  UNDERSTANDING COMPUTER APPLICATION
OUTPUT:  D and E are consecutive characters.
                  R and S are consecutive characters.
                  S and T are are consecutive characters.  
#include <stdio.h>
void main()
{
    char a[100];
    int i;
    printf("Enter a String\n");
    scanf("%s",&a);
    for(i=0;i!='\o';i++)
    {
        if((int)a[i]==((int)a[i+1]-1))
        printf("%c and %c are consecutive characters\n",a[i],a[i+1]);
    }
}

No comments:

Post a Comment