///Md. Alamgir Hossain
///Dept. of Computer Science & Engineering
///Jessore University of Science & Technology
Solution of Toggle String on hackerearth in C..
#include<stdio.h>
#include<string.h>
int main()
{
int ln,i;
char ch[100];
scanf("%s",ch);
i=0;
ln=strlen(ch);
while(i!=ln){
if(islower(ch[i]))
{
ch[i]=toupper(ch[i]);
}
else if(isupper(ch[i]))
{
ch[i]=tolower(ch[i]);
}
i++;
}
for(i=0;i<ln;i++){
printf("%c",ch[i]);
}
return 0;
}
///Dept. of Computer Science & Engineering
///Jessore University of Science & Technology
Solution of Toggle String on hackerearth in C..
#include<stdio.h>
#include<string.h>
int main()
{
int ln,i;
char ch[100];
scanf("%s",ch);
i=0;
ln=strlen(ch);
while(i!=ln){
if(islower(ch[i]))
{
ch[i]=toupper(ch[i]);
}
else if(isupper(ch[i]))
{
ch[i]=tolower(ch[i]);
}
i++;
}
for(i=0;i<ln;i++){
printf("%c",ch[i]);
}
return 0;
}
No comments:
Post a Comment