Write a C program to accept string from user and display alternate character of string in upper case .(eg: I/P hello O/P hElLo)


#include<stdio.h>
#include<conio.h>
void  main()
{
            char str[30];
            int i;
            clrscr();
            printf("\n enter the string");
            gets(str);

    for(i = 0; str[i] != 0; i++)
    {
        if( (i % 2) == 0)
            str[i] = tolower(str[i]);
        else
            str[i] = toupper(str[i]);
    }
    printf("%s\n", str);
getch();
}