Sunday, February 25, 2018

C program to print alternate letters of a word entered from keyboard



#include<stdio.h>

int main()
{
    char str[100];
    char c='a';
    int i=0;
    printf("type a word \n");

    while(c != '\n')
    {
        c = getchar();
        str[i]=c;
        i++;
    }
    for (int j=0;j<=i;j++)
    {
        printf("%c ",str[j]);
        j++;
    }
return 0;
}

Thanks
Happy computing !

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...