Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a program using pointer variables to read a character
- until * is entered. If the character is in upper case,
- print it in lower case and vice versa. Also count the no.
- of upper and lower case characters entered. */
- #include<conio.h>
- #include<stdio.h>
- void main()
- {
- char ch, *c;
- int u=0, l=0;
- clrscr();
- c=&ch;
- printf("\n-----------------------------------------------------------------------------");
- printf("\n Enter Character Convert Opposite Case And Count Character Upper And Lower");
- printf("\n-----------------------------------------------------------------------------");
- printf("\n Note Exit Program Enter '*' Sybol");
- printf("\n-----------------------------------------------------------------------------");
- printf("\n Enter Character : ");
- scanf("%c",&ch);
- while(*c !='*')
- {
- if(*c >= 'A' && *c <= 'Z')
- {
- *c=*c+32;
- u++;
- }
- else if(*c >= 'a' && *c <= 'z')
- {
- *c=*c-32;
- l++;
- }
- printf(" Character : %c", *c);
- printf("\n\n Enter Character : ");
- fflush(stdin);
- scanf("%c",c);
- }
- printf("\n-------------------------------------");
- printf("\n No. Of Upper Character is %d",u);
- printf("\n No. Of Lower Character is %d",l);
- printf("\n-------------------------------------");
- getch();
- }
Add Comment
Please, Sign In to add comment