3. C program to convert temperature from degree Celsius to Fahrenheit.
#include <stdio.h> int main() { float celsius, fahrenheit; printf("Enter temperature in Celsius: "); scanf("%f", &celsius); fahrenheit = (celsius * 9 / 5) + 32; printf("%.2f Celsius = %.2f Fahrenheit ", celsius, fahrenheit); return 0; } 4. C program to convert days into years, months and days. #include <stdio.h> int main() { int total_days, years, months, days; printf("Enter number of days: "); scanf("%d", &total_days); years = total_days / 365; total_days = total_days % 365; months = total_days / 30; days = total_days % 30; printf("%d years, %d months, and %d days\n", years, months, days); return 0; }
5. C program to calculate total, average and percentage of 5 subjects.
#include <stdio.h> int main() { float sub1, sub2, sub3, sub4, sub5; float total, average, percentage; printf("Enter marks of five subjects: "); scanf("%f %f %f %f %f", &sub1, &sub2, &sub3, &sub4, &sub5); total = sub1 + sub2 + sub3 + sub4 + sub5; average = total / 5; percentage = (total / 500) * 100; printf("Total: %.2f\n", total); printf("Average: %.2f\n", average); printf("Percentage: %.2f%%\n", percentage); return 0; }