Escape sequence character

A character preceded by backspace (\) is known as escape sequence character. An escape sequence character is a special character because it made by using two character but internally treated as single character.
A escape sequence character is specially used for change output format.



Expalanation  :-
Write a C program to display statement as a following format:-

(a)    WELCOME
TO
C
Soln         void main()
                {
                clrscr();
                printf(“WELCOME \n TO \n C”);
                getch();
                }

      (b)   WELCOME
TO C
Soln         void main()
                {
                clrscr();
                printf(“WELCOME \n \t TO C”);
                getch();
                }

      (c)    WELCOME TO C

WELCOME
TO
FRNDZONE
Soln         void main()
                {
                clrscr();
                printf(“WELCOME TO C \n \n WELCOME \n TO \n FRNDZONE”);
                getch();
                }
      
      (d)   “Feel the sensation of your destination”
Soln         void main()
                {

                clrscr();
                printf(“\” Feel the sensation of your destination\””);
                getch();
                }


      (e)   WELCOME TO FRNDZONE/C
Soln         void main()
                {
                clrscr();
                printf(“WELCOME  TO FRNDZONE\\C”);
                getch();
                }


      (f)     Convert Welcome to Celcome
Soln         void main()
                {
                clrscr();
                printf(“WELCOME  \r  C”);
                getch();
                }
Outputà CELCOME

                [\r points the cursor to its home position.Here also we can see that welcome first letter                         overwritten by C]

      (g)    Convert  CELLONE to CELLTWO
Soln         void main()
                {
                clrscr();
                printf(“CELLONE \b \b \b  TWO”);
                getch();
                }

Outputà CELLTWO


                [Here we give CELLONE to print but it will give output CELLTWO]

Comments

Popular Posts