Friday, January 25, 2013

Conditional Statements


Copy the source code on Dev C++ and Run. Upload the C file on Moodle.
Program 1 - Filename: if.c
#include<stdio.h>
main()
{
float fPrice;

printf("Enter the price: "); 
scanf( "%f", &fPrice );
if ( fPrice >= 1000 )
{
printf( "Expensive!\n" );
printf( "Can’t Afford!" );
}
getchar(); getchar();
}
____________________________________________________
Program 2 - Ifelse.c
#include <stdio.h>
main()
{
double dGrade;
scanf( "%lf", &dGrade );
if ( dGrade >= 60 )
{
printf( "Congratulations!\n" );
printf( "You passed." );
}
else
{
printf( "Sorry.\n" );
printf( "You failed." );
}
getchar(); getchar();
}








Call me and you will get the knowledge and skills you need instantly.
For inquiries contact me on my mobile number or email me at inquiry@eglobiotraining.com. View my multiply site http://erwinglobio.multiply.com
 
 
Prof. Erwin M. Globio, MSIT
Senior IT Lecturer
Far Eastern University
Email Address: inquiry@eglobiotraining.com
Skype: erwinglobio
 
 
Call Now:
 
SMART: 09393741359
SUN: 09323956678


No comments:

Post a Comment