// Demo of reading and printing variables
// Marc Chee (cs1511@cse.unsw.edu.au), September 2019

#include <stdio.h>

#define ANSWER 42

int main(void) {
    int seven = 7;
    int answer;
    printf("Please type in a number:\n");
    scanf("%d", &answer);
    printf("You typed in %d and the real answer is %d\n", answer, ANSWER);
    return 0;

Resource created Wednesday 27 January 2021, 01:16:14 PM, last modified Monday 15 February 2021, 04:26:14 PM.

file: printDemo.c

Back to top

COMP1511 21T1 (Programming Fundamentals) is powered by WebCMS3
CRICOS Provider No. 00098G