i am just new to C programing and in in a need for some help for these problems

1#

Write a program that prompts the user for the area and perimeter of a rectangle. Then it will compute the width and length and display them on the screen (width <= length).

The mathematical relations for area and perimeter of a rectangle are given below.

This problem needs a solution of a quadratic equation. This equation is obtained by finding the expression of length (width) from perimeter equation. Then, you substitute it in area equation. This will give you a quadratic equation in terms of width (length).

2#

Write a program that reads a charactert from the user and prints one of the following messages:

You typed a digit

You typed a capital letter

You typed a small letter

Your typed character is not a letter or a digit

*** i need to know the error in this program

this program does compile

#include <stdio.h> int main() { printf("please type your choice (1 or 2):\n"); printf("1: Convert from miles to kilometers\n"); printf("2: Convert from feets to meters\n"); int choice; double km ,miles, meters, feets, miles2km , feets2meters; scanf("%i", &choice); switch(choice) { case 1: printf("Enter the number of miles to convert to kilometers:\n"); scanf("%lf", &miles); [[not performed when running the program]] miles2km = miles*1.609; printf("%.2lf miles = %.2lf kilometers\n", miles, miles2km); break; case 2: printf("Enter the number of feets to convert to meters:\n"); scanf("%lf", &feets); [[not performed when running the program]] feets2meters = feets*0.3048 ; printf("%.2lf feets = %.2lf meters\n", feets, feets2meters); break; default: printf("wrong input, you need to type 1 or 2."); break; } return 0; }

This post has been edited by **Jayman**: 14 November 2008 - 02:46 PM