#include <stdio.h>

int main(void)

{     // variable declaration

int i,z;

char letters[26] = {

‘a’,’b’,’c’,’d’,’e’,’f’,’g’,

‘h’,’i’,’j’,’k’,’l’,’m’,’n’,

‘o’,’p’,’q’,’r’,’s’,’t’,’u’,

‘v’,’w’,’x’,’y’,’z’

},

search;

// read user input

scanf(“%c”, &search);

 

// User input conversion lower char

if(search>=65 && search<=90)

search=search+32;

 

//my for loop start here

for (i = 0; i < 26; i++){

 

// checking where the user input and my array value are matching

if(search==letters[i]){

 

//Decrement value generating

for (z=i-3; z<=i-1; z++)

printf(“%c”,letters[z]);

 

//increment value generating

for (z=i; z <= i+3; z++)

printf(“%c”,letters[z]);

}

// end main for loop

}

 

return 0;

}

Leave a reply