Assignment 1
Assignment 1
Write your name, roll number and assignment number in the header of the
program file as comments. You may give your program file name as
<asgn><no_><RollNo>.c. For example, a student with roll number 21CS1001
should name the program file for assignment number 1(a), as
asgn1a_21CS1001.c. Submit all the programs in the Moodle System 15 minutes
before the end of the laboratory session. Provide also output files containing
results given the set of inputs given here. Please follow the instruction for
generating result files provided at the end.
(a) Compute the perimeter of a triangle given its coordinates of its three
vertices (to be read).
All the results for each assignment should be submitted together in a separate
file (named result.txt). Provide the result in a separate output file (named,
result_<assgn><no>.txt). Use standard output redirection feature to generate
the output file.
Hints. Suppose you would like to redirect your output to a file ‘result.txt’.
If you run the program with the following command
./a.out >result.txt
If you execute the program multiple times, you may concatenate the
outputs in a single file by using the following redirection command:
./a.out >>result.txt
You may also store your input (the ordering as per requirement of
the program should be preserved) in an input file in.txt, and execute the
program as follows: