Question 3 [12 marks]:
double num1 = 1234567.456, num2 = 123.456, num3= 123.456, num4 = 123456.789;
int num5 = 123456;
Write a program that includes the following statements:
1. A printf statement that displays the value of num1 formatted as: 1,234,567.46
A printf statement that displays the value of num2 rounded to one decimal place, in a field that is ten spaces wide (Do not use comma separators).
A printf statement that displays the value of num3 padded with leading zeros, in a field that is eight spaces wide, rounded to one decimal place (Do
not use comma separators).
A printf statement that displays the value of num4, left-justified, with comma separators, in a field that is 20 spaces wide, rounded to two decimal
A printf statement that displays the value of num5 in a field that is 10 spaces wide, with no comma separators.
A printf statement that displays the value of name in a field that is 20 spaces wide.
• Write the comments on your program whenever necessary;
• Use proper indentation to make your code read easily (no spaghetti coding please);
• You can share ideas with others, but not code. You must write your program independently. If you are found to copy each other's program or copy from
online, you will get negative total of the assignment on the whole assignment even if cheating on one question;
• Follow submission instructions (see below for how to submit your assignment online) properly. Late assignments will not be accepted. Please don't
submit your assignments to Dr. Srivastava or John Chen via email.
*The amount will be in form of wallet points that you can redeem to pay upto 10% of the price for any assignment. **Use of solution provided by us for unfair practice like cheating will result in action from our end which may include permanent termination of the defaulter’s account.Disclaimer:The website contains certain images which are not owned by the company/ website. Such images are used for indicative purposes only and is a third-party content. All credits go to its rightful owner including its copyright owner. It is also clarified that the use of any photograph on the website including the use of any photograph of any educational institute/ university is not intended to suggest any association, relationship, or sponsorship whatsoever between the company and the said educational institute/ university. Any such use is for representative purposes only and all intellectual property rights belong to the respective owners.