Solution for Exercise 7-6

ex0706

#include <stdio.h>

int main()
{
    int ch;

    printf("Press Enter: ");
    getchar();
    ch = 'H';
    putchar(ch);
    ch = 'i';
    putchar(ch);
    putchar('!');
    putchar('\n');
    return(0);
}

Notes

* The newline character is \n. It's an escape sequence and it must be enclosed in single quotes because it's a character.

* You could have also assigned the newline to variable ch and then used putchar() to display that variable.