CS13002 Programming and Data Structures | Spring semester |
/************************************ * Name : Your name * * Roll Number : Your roll number * * PC Number : Number of your PC * * Assignment : Assignment number * * Exercise : Exercise number * ************************************/ Write your program here /***** End of program *****/
$ cc myprog.c # Compile your program $ ./a.out # Run your program, debug, etc. ... # Now you are sure that your program is correctly running # and you are getting the desired output. $ rm myprog.out myprog.prn # Delete old occurrences, if any (optional) $ ./a.out > myprog.out # Redirect output to the file myprog.out # If you want to take further runs, say with different input values, # append the new sessions of the runs to myprog.out. $ ./a.out >> myprog.out $ ./a.out >> myprog.out ... $ cat myprog.c myprog.out > myprog.prn # Generate the printer file $ cat myprog.prn # View the printer file to check that everything is okay $ lpr myprog.prn # Fire the print command
printf("Input a positive integer : "); /* Prompt for the user */ scanf("%d",&n); /* Read user's input */ printf("%d\n",n); /* Echo the input value */
$ less myprog.prn
Key | Action |
---|---|
[Space] | Go to next page |
[Return] | Scroll down one line |
[Up] | Scroll up one line |
[Down] | Scroll down one line |
g | Go to the beginning |
G | Go to the end |
q | Quit less |
h | Display help on less |
You are supposed to preserve your print-outs. We need not correct your programs as soon as they are printed. We will give you the print-outs in the lab. You will be asked to produce those at a later time for evaluation.