skip to main | skip to sidebar

Wednesday, August 24, 2011

Requested Tutorial Basic input with if else Conditions

A sociological study clasifies a family of three persons as POOR, MIDDLE CLASS and WEALTHY. provided that family income is less than 12,000.00 Php between 12,000.00 and 70,000.00 Php respectively.

The Problem

Create a program which acepts family income as input from the user and displays the proper classification of the family.
FAMILY INCOME CLASSIFICATION
FAMILY INCOME
below 12,000 - POOR
12,000 - 70,000 - MIDDLE CLASS
above 70,000 - WEALTHY

Requested By: Jp Natividad


#include <stdio.h>
#include <conio.h>

void main() {
clrscr();
int income;
printf("Enter your income: ");
scanf("%d",&income);
if (income < 12000) {
printf("Family income classification: POOR \n\n");
printf("FAMILY INCOME: %d",income);
}
else if(income >= 12000 && income <= 70000)
{
printf("Family income classification: MIDDLE CLASS \n");
printf("FAMILY INCOME: %d",income);
}
else if(income > 70000)
{
printf("Family income classification: WEALTHY \n");
printf("FAMILY INCOME: %d",income);
}
getch();
}




0 comments:

Post a Comment