09-Unformatted Output Functions
09-Unformatted Output Functions
Unformatted
Output
Functions
B.Bhuvaneswaran, AP (SG) / CSE
9791519152
[email protected]
putchar() Function
Writing a single character can be done by using the function
putchar().
The character being transmitted will normally be expressed as an
argument to the function enclosed in parenthesis following the
word putchar.
#include <stdio.h>
#include <ctype.h>
int main()
{
char ch;
printf("Enter an alphabet : ");
ch = getchar();
if(isupper(ch))
putchar(tolower(ch));
else
putchar(toupper(ch));
return 0;
}
Enter an alphabet : B
b
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
int main()
{
char ch;
printf("Enter an alphabet : ");
ch = getchar();
if(isupper(ch))
putch(tolower(ch));
else
putch(toupper(ch));
return 0;
}
Enter an alphabet : B
b
#include <stdio.h>
int main()
{
char text[80];
printf("Enter the text. Press ENTER at the end :\n");
gets(text);
puts(text);
return 0;
}