answersLogoWhite

0

#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;}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Write a C program to accept a string from user and display its ascii value and then display sum of all ascii value of strings?

//C program to accept a string from user and //display its ascii value and //then display sum of all ascii value of strings #include&lt;stdio.h&gt; #include &lt;string.h&gt; int main() { char String[100]; int Sum,Index; Sum=0; //Sum is initially zero printf("Enter the string:\n"); gets(String); //Accept String from User for(Index=0;Index&lt;strlen(String);Index++) { Sum+=(String[Index]); //Adds (the ASCII values of) the String characters. } printf("The sum is %d\n",Sum); //Printing it as %d gives the equivalent ASCII value. return 0; }


Write a program in c to convert a given string to lower case?

Use the tolower() function. Example: char* a = 'X'; a = tolower(a); printf("%c", a);


How do you display a text reversely in C language without using onlu simply input and output?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { char string[20]; int i=0; printf("Enter the string.\n"); while(i&lt;=19) { scanf("%c",&amp;string[i]); i++; } while(i&gt;=0) { printf("%c",string[i]); i--; } getch(); } In this program it is compulsory to enter 20 characters. Now we can write a program in which it is not necessary. #include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;string.h&gt; void main() { char string[20]; int length; printf("enter the string.\n"); gets(string); length=strlen(string); length--; while(length&gt;0) { printf("%c",string[length]); length--; } getch(); }


How i display numbers on LCD embedded c?

To display numbers on an LCD using embedded C, you typically use a microcontroller with an appropriate LCD library. First, initialize the LCD by setting up the data and control pins. Convert the number to a string format using sprintf() or similar functions, then use the LCD's print or write function to send the string to the display. Make sure to properly manage the cursor position before displaying the number.


1 Define a class in C plus plus to store following information of books Title Author Publisher Price?

class Book { public: Book(std::string title, std::string author, std::string publisher, double price) : m_title(title), m_author(author), m_publisher(publisher), m_price(price) {} std::string get_title()const{return(m_title);} std::string get_author()const{return(m_author);} std::string get_publisher()const{return(m_publisher);} int get_price()const{return(m_price);} private: std::string m_title; std::string m_author; std::string m_publisher; double m_price; }


What is the difference between a C plus plus string and a C-style string?

A std::string is an object that encapsulates an array of type char whereas a C-style string is a primitive array with no members. A std::string is guaranteed to be null-terminated but a C-style string is not.


What is the c string in voilin?

There is no C string on a violin- the strings are G, D, A and E. Perhaps you are thinking of a viola, which has a low C string, alongwith a G, D and an A string.


How do you write a program in c to display numbers from 0 to 9 along with the string?

#include &lt;stdio.h&gt; int main (void) { puts ("0123456789"); return 0; }


C plus plus program to accept a string from user and count number of vowels in the string using pointer to string?

#include #include void main() { char str[50]; int i,count,countc; printf("Enter a string : "); gets(str); count=0; i=0; while(str[i]!='\0&prime;) { if(str[i]==' ') count++; i++; } printf("The total number of words are %d ",count+1); } Read more: http://programmingkid.com/count-number-of-words-in-a-string/#ixzz1aGIR1odb


C plus plus library functions for string operations?

You can use "string" class in C++ for string operations or you may use c style string functions as well. #include &lt;string&gt; String class in C++ provides all basic function to operate on strings. you may details descriptin at http://www.cplusplus.com/reference/string/string/


Is there a c-string thong for men?

yes, c-string is available for men..


What are strings?

Some stringed instruments contain a C-string, producing sound from the string creates the note C, so it is called C-string.