Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Let's code a weight converter with C programming! ๐Ÿ‹๏ธ
Play lesson

C tutorial for beginners โš™๏ธ - Let's code a weight converter with C programming! ๐Ÿ‹๏ธ

4.0 (0)
13 learners

What you'll learn

This course includes

  • 6.5 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#coding #programming #cprogramming // WEIGHT CONVERTER PROGRAM int choice = 0; float pounds = 0.0f; float kilograms = 0.0f; printf("Weight Conversion Calculator\n"); printf("1. Kilograms to Pounds\n"); printf("2. Pounds to Kilograms\n"); printf("Enter your choice (1 or 2): "); scanf("%d", &choice); if(choice == 1){ // Kilograms to Pounds printf("Enter the weight in kilograms: "); scanf("%f", &kilograms); pounds = kilograms * 2.20462; printf("%.2f kilograms is equal to %.2f pounds\n", kilograms, pounds); } else if(choice == 2){ // Pounds to Kilograms printf("Enter the weight in pounds: "); scanf("%f", &pounds); kilograms = pounds / 2.20462; printf("%.2f pounds is equal to %.2f kilograms\n", pounds, kilograms); } else{ printf("Invalid choice! Please enter 1 or 2\n"); } return 0;

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere