Skip to main content

Posts

Showing posts with the label c program to print string in lowercase

Sample C Program to accept a string in upper case and print it in lower case.

28) Sample C Program to accept a string and print it by using the while loop. # include <stdio.h> # include <conio.h> main( ) { char ch; clrscr(); printf("Enter a string:"); while(( ch = getchar() ) != '\n')    putchar(ch); getch(); } 29) Sample C Program to accept a string in upper case and print it in lower case. # include <stdio.h> # include <conio.h> main( ) { char ch,c; clrscr(); printf("Enter a string in upper case:"); while(( ch = getchar( ) ) != '\n')   {      c = ch + 32;      putchar(c);   } printf(" :String In Lower Case"); getch( ); } 30) Sample C Program to accept a string in any case and print it by another case. # include <stdio.h> # include <conio.h> main( ) { char ch; clrscr( ); printf("Enter a string:");  while(( ch = getchar( )) != '\n') { if(ch >= 'A' && ch <= 'Z') putchar(ch + 32); else ...