Skip to main content

UNIT CONVERTER PROGRAM IN C.

THIS PROGRAM IS WRITTEN IN C /* Program to convert length to different units*/ #include int main(void) { float length, converted, measure; char inUnits, outUnits; printf("Enter the value of length to be converted: "); scanf("%f", &measure); printf("Enter the unit of value entered (I, F, Y, or M): "); scanf("%c", &inUnits); printf("Enter the unit to convert value to (c, m, or k): "); scanf("%c", &outUnits); switch(inUnits){ case 'I': converted = measure * 2.54001; printf("The length you entered in inches is equal to %f centimeters", converted); break; case 'Y': converted = measure * 0.9144402; printf("The length you entered in yards is equal to %f meters", converted); break; case 'M': converted = measure * 1.60935; printf("The length you entered in miles is equal to %f kilometers", converted); break; case 'F': switch(outUnits){ case 'c': converted = measure * 30.4801; printf("The length you entered in feet is equal to %f centimeters", converted); break; case 'm': converted = measure * 0.304801; printf("The length you entered in feet is equal to %fmeters", converted); break; default: printf("Incorrect unit entered. Please enter a valid unit."); break;} break; default: printf("Incorrect unit entered. Please enter a valid unit."); break;} return 0; } Faq

Comments

Popular posts from this blog

PROGRAMMING WITH C 7.12      (Card Shuffling and Dealing) Modify the program in Fig. 7.24 so that the card-dealing function deals a five-card poker hand. Then write the following additional functions: a) Determine whether the hand contains a pair. b) Determine whether the hand contains two pairs. c) Determine whether the hand contains three of a kind (e.g., three jacks). d) Determine whether the hand contains four of a kind (e.g., four aces). e) Determine whether the hand contains a flush (i.e., all five cards of the same suit). f) Determine whether the hand contains a straight (i.e., five cards of consecutive face values) ANSWER 7.12 #include<stdio.h> #include<stdlib.h> #include<time.h> //main functions void shuffle( int wDeck[][ 13 ] ); void deal( const int wDeck[][ 13 ], const char *wface[], const char *wSuit[], char *wfSuit[], char *wfFace[] ); //operation functions void pair( const char *...
Hei guys ! Watch out for more on c plus plus

WhatsApp Tips and Tricks

Send Disappearing Messages Disappearing messages automatically delete themselves after a certain period of time. That way, you won’t have to worry about your message being saved or forwarded without your knowledge. WhatsApp gives you the option of having messages disappear after 24 hours, 7 days or 90 days. You can turn it on for specific conversations with anyone you choose. Keep in mind though that the preview of the message will remain viewable in the notifications panel until you open the app, even if the time lapses for the message period. To turn on disappearing messages, follow these steps: Open the WhatsApp chat you want to use disappearing messages on. Click on the contact’s name. Click on “disappearing messages.” Select your preferred duration. Alternatively, if you want to enable disappearing messages for all your contacts, you can do this: Open Settings. Tap Account, then go to Privacy. Select Default message timer and then select your preferred duration...