Escape Sequences in printf function - C Data Type

C examples for Data Type:char

Description

Escape Sequences in printf function

Demo Code

#include <stdio.h>

int main(void){
    float salary;
    /*  w  ww .j a v a 2  s .c  om*/
    printf("\aEnter your desired monthly salary:");/* 1 */
    printf(" $_______\b\b\b\b\b\b\b");             /* 2 */
    scanf("%f", &salary);
    printf("\n\t$%.2f a month is $%.2f a year.", salary,
           salary * 12.0);                         /* 3 */
    printf("\rHi!\n");                            /* 4 */
    
    return 0;
}

Result


Related Tutorials