1. #include <stdio.
h>
int main(){
int num1, num2;
printf("Enter first number: ");
scanf("%d", &num1);
printf("Enter second number: ");
scanf("%d", &num2);
printf("Sum=%d\n", num1 + num2);
printf("Difference=%d\n", num1 - num2);
printf("Product=%d\n", num1 * num2);
printf("Quotient=%d\n", num1 / num2);
printf("Remainder=%d\n", num1 % num2);
return 0;
}
2. #include <stdio.h>
int main() {
double length, width, area, perimeter;
printf("Enter the length: ");
scanf("%lf", &length);
printf("Enter the width: ");
scanf("%lf", &width);
area = length * width;
perimeter = 2 * (length + width);
printf("Area=%.6lf\n", area);
printf("Perimeter=%.6lf\n", perimeter);
return 0;
}
3. #include <stdio.h>
int main() {
float feet, inches;
printf("Enter distance<feet>: ");
scanf("%f", &feet);
float feet_cm = feet * 30.48;
printf("%.6lf feet = %.6lf cm\n", feet, feet_cm);
printf("Enter distance<inches>: ");
scanf("%f", &inches);
float inches_cm = inches * 2.54;
printf("%.6lf inches = %.6lf cm\n", inches, inches_cm);
return 0;
}
4. #include <stdio.h>
int main() {
float farenheit, celsius;
printf("Enter the temperature in Farenheit:");
scanf("%f", &farenheit);
celsius = (5.0 / 9.0) * (farenheit - 32);
printf("Farenheit temperature is: %.6f\n", farenheit);
printf("Celsius temperature is: %.6f\n", celsius);
return 0;
}
5. #include <stdio.h>
int main() {
int seconds, hours, minutes;
printf("Enter time <seconds>: ");
scanf("%d", &seconds);
hours = seconds/3600;
minutes = (seconds % 3600)/60;
seconds %= 60;
printf("Time is %d hours, %d minutes, and %d seconds\n", hours, minutes, seconds);
return 0;
}