Documente Academic
Documente Profesional
Documente Cultură
Void main( )
{ int i, marks[5]={55,56,67,78,64};
for(i=2;i<=4;i++)
printf(“%d ”,marks[i]);
}
Programs in unit-2
1. Write a C program to find maximum of 3 numbers using conditional operator
2. Write a C program to find all roots of a quadratic equation.
3. A library charges a fine for every book returned late. For first 5 days the fine is 50 paise
per day,for 6 days fine is one rupee per day,for above 10 days fine is 5 rupees per
day.if you return the book after 30 days your membership will be cancelled .Write a
program to accept number of member is late and display the fine or the appropriate
message.
4. Write a C program to input marks of five subjects Physics, Chemistry, Biology,
Mathematics and Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F