c programm to print text into uppercase, other programmes


Program to Print text into Upper casing until interrupted using CTRL + Z
Program
#include<stdio.h>
void main()
{
char ch;
printf("\nPlease Enter the Data. To Stop Press CTRL+Z.\n\n");
while((scanf("%c", &ch)) > 0)
if(ch >= 'a' && ch <= 'z')
printf("%c", ch - 'a' + 'A');
else
printf("%c", ch);
}
Program to Final Maxuimum of Numbes Entered until interrupted by CTRL + Z
Program
#include<stdio.h>
void main()
{
int n,max=0;
printf("/nEnter the Numbers : \n\n");
while((scanf("%d", &n)) > 0)
{
printf("\nThe Given Number is : %d.\t", n);
if(max < n)
max = n;
printf("The Maximum at Present is : %d\n", max);
}
}

Program to Count No of Characters until Interrupted by CTRL + Z
Program
#include<stdio.h>
void main()
{
int no_chars = 0;
while(getchar() != EOF)
++no_chars;
printf("\nThe Number of Characters Entered are : %d.", no_chars);
}

No comments: