answersLogoWhite

0

AllQ&AStudy Guides
Best answer

#include<stdio.h>

#include<conio.h>

#include<string.h>

int main()

{

int tmp,i;

char str[30];

printf("Enter any string: ");

gets(str);

for(i=0; str[i]!='\0'; i++) {

if(str[i-1]==' ' i==0)

{

if(str[i]>='a' && str[i]<='z')

str[i]=str[i]-32;

else

if(str[i]>='A' && str[i]<='Z')

str[i]=str[i]+32;

}

printf("%c",str[i]);

}

getch();

return 0;}

This answer is:
Related answers

#include<stdio.h>

#include<conio.h>

#include<string.h>

int main()

{

int tmp,i;

char str[30];

printf("Enter any string: ");

gets(str);

for(i=0; str[i]!='\0'; i++) {

if(str[i-1]==' ' i==0)

{

if(str[i]>='a' && str[i]<='z')

str[i]=str[i]-32;

else

if(str[i]>='A' && str[i]<='Z')

str[i]=str[i]+32;

}

printf("%c",str[i]);

}

getch();

return 0;}

View page

RemoveSpaces (char *str) {

char *new = str;

while (*str != '\0') {

if (*str != ' ') *(new++) = *str;

str++;

}

*new = '\0';

}

View page

void to_uppercase (char* str) {

if (str == 0) return;

while (*str != '\0') {

if (*str>='a' && *str<='z') *str-=32;

++str;

}

}

View page

#include<stdio.h> int main() { char str[100]; int i; printf("Please enter a string: "); // gets(str); // fgets is a better option over gets to read multiword string . fgets(str, 100, stdin); // Following can be added for extra precaution for '\n' character // if(str[length(str)-1] == '\n') str[strlen(str)-1]=NULL; for(i=0;str[i]!=NULL;i++) { if(str[i]>='A'&&str[i]<='Z') str[i]+=32; else if(str[i]>='a'&&str[i]<='z') str[i]-=32; } printf("String in toggle case is: %s",str); return 0; }

View page

str

View page
Featured study guide

Teddy Bears

17 cards

What is dry humping

Can you get pregnant from pre- ejaculation

Get pregnant from dry humping

What lives in a humpy

➡️
See all cards
3.71
63 Reviews
More study guides
3.0
4 Reviews

4.0
5 Reviews
Search results