COLLEGE OF ENGINEERING
Computer Engineering Department
Assignment #1
NES 113 – EN2C
Submitted To:
Mr. Alexis John M. Rubio
CpE Professor
Submitted By:
Rosit, Laila D.
20101164583
August 15, 2013
3.1. Make a C program that will accept any integers from 1-12 and displays equivalent month, Example if 3, “March”.
#include<stdio.h>
#include<conio.h>
int month; int main()
{
printf("Enter a Month:"); scanf("%d",&month); switch(month)
{
case 1: printf("January"); break; case 2: printf("February"); break; case 3: printf("March"); break; case 4: printf("April"); break; case 5: printf("May"); break; case 6: printf("June"); break; case 7: printf("July"); break; case 8: printf("August"); break; case 9: printf("September"); break; case 10: printf("October"); break; case 11: printf("November"); break; case 12: printf("December"); break; default: printf("1 to 12 only!");
}
getch();
}
3.3. Construct a C program that will enter three integers and display the highest value, assuming all inputs are different.
#include<stdio.h> #include<conio.h> int main() { float num1, num2, num3; printf("Enter three numbers:"); scanf("%f %f %f",&num1,&num2,&num3); if(num1>=num2 && num1>=num3) printf("Highest value= %.2f",num1); if(num2>=num1 && num2>=num3) printf(" Highest value= %.2f",num2); if(num3>=num1 && num3>=num3) printf("Highest value= %.2f",num3); getch() }
3.4. Any customer whose total PURCHASE is at least P1000 will be given a 10% discount. Make C program that would input the customer’s purchase and output his net BILL
#include<stdio.h> #include<conio.h> main() { float dis,price,tot_bill; printf("Enter the price\n"); scanf("%d%f",&price); if(price=1000); {dis=(float)0.10;