25) Sample C Program to accept a character in Uppercase & print in Lowercase.
# include <stdio.h>
# include <conio.h>
main( )
{
char ch, c1;
clrscr( );
printf("Enter a character in Uppercase:");
ch = getchar();
c1 = ch + 32;
printf("The given character in Lowercase is:");
putchar(c1);
getch();
}
26) Sample C Program to accept a character in any case and print it in another case.
# include <stdio.h>
# include <conio.h>
main( )
{
char ch, c1;
clrscr( );
printf("Enter a character in any case(Uppercase/Lowercase):");
ch = getchar();
if(ch >= 65 && ch <= 90)
c1 = ch + 32;
elseif(ch >= 97 && ch <= 122)
c1 = ch - 32;
endif;
printf("The given char in other case is:");
putchar(c1);
getch();
}
27) Sample C Program to print natural number from 1 to 10 by using while loop.
# include <stdio.h>
# include <conio.h>
main( )
{
int a = 0;
clrscr();
while( a < 10)
{
a = a + 1;
printf("%d\n",a);
}
getch();
}
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com