0% found this document useful (0 votes)
60 views

Assignment 1

The document contains 5 questions related to C programming: 1. It asks to identify which of 9 given variable names are invalid in C and why. 2. It asks to point out any errors in 6 given C code statements. 3. It asks to write the appropriate scanf and printf functions to read and print values for variables i, j, and k that are declared as integers. 4. It asks if it is true or false that each new C instruction must be written on a separate line. 5. It provides 4 programming problems to write C code: a) to calculate gross salary from basic salary, b) to interchange values in two variables with and without a temporary variable

Uploaded by

hariharanbook
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Assignment 1

The document contains 5 questions related to C programming: 1. It asks to identify which of 9 given variable names are invalid in C and why. 2. It asks to point out any errors in 6 given C code statements. 3. It asks to write the appropriate scanf and printf functions to read and print values for variables i, j, and k that are declared as integers. 4. It asks if it is true or false that each new C instruction must be written on a separate line. 5. It provides 4 programming problems to write C code: a) to calculate gross salary from basic salary, b) to interchange values in two variables with and without a temporary variable

Uploaded by

hariharanbook
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment -1

Q1 : Which of the following are invalid variable names and why ?


1. interestpaid
2. si-int
3. AVERAGE
4. Percent.
5. 123
6. dist in km
7. ot pay
8. Name
9. FLOAT
Q2 : Point out the errors, if any, in the following C statements:
1. int =314.562 *150 ;
2. name = Ajay;
3. 3.14 * r*r = area;
4. k=a*b+c(2.5a+b);
5. m_inst =rate of interest * numberofyears /100;
6. area = 3.14 * r **2;
Q3 : A C program contains the following statements:
#include<stdio.h>
int i,j,k;
write appropriate scanf and printf functions to enter and print the numerical values for i,j and k
Q4 : Each new c instruction has to be written on a separate line. (True/false)

Q5 : Write C programs for the following :


(a) Rajeshs basic salary is input through the keyboard. His dearness allowance is 40% of basic
salary, and house rent allowance is 20 % of basic salary. Write a program to calculate his gross
salary.
(b) Two numbers are input through the keyboard into two locations C and D . Write a program to
interchange the contents of C and D.
using temporary variable.
without using temporary variable
(c) If the marks obtained by a student in five different subjects are input through the keyboard, find
out the aggregate marks and percentage marks obtained by the student. Assume that the maximum
marks that can be obtained by a student in each subject is 100.
(d) The length and breadth of a rectangle and radius of a circle are input through the keyboard. Write
a program to calculate the area and perimeter of the rectangle, and the area and circumference of the
circle.

You might also like