Tuesday, March 31, 2009


#include#includevoid main(){clrscr();int day;printf("Enter a number:");scanf("%d",&day);switch(day){case 1:printf("Sunday");break;case 2:printf("Monday");break;case 3:printf("Tuesday");break;case 4:printf("Wednesday");break;case 5:printf("Thursday");break;case 6:printf("Friday");break;case 7:printf("Saturday");break;default:printf("Oops! Sorry! That day is not available!");}getch();}


Tuesday, February 24, 2009

EXER7 CS121

OUTPUT OF EXERCISE 7
Photobucket

CODES USED:

#include
#include
#include
void menu();
void nextscreen();
void nextscreen2();

void nextscreen()
{
clrscr();
int x,y,z;
for(x=1;x<=77;x++)
{
gotoxy(2+x,1);textcolor(GREEN);cprintf("Í");
//delay (10);
gotoxy(2+x,21);textcolor(GREEN);cprintf("Í");
//delay (10);
}
for(y=1;y<=20;y++)
{
gotoxy(3,1+y);textcolor(GREEN);cprintf("º");
//delay (10);
gotoxy(79,1+y);textcolor(GREEN);cprintf("º");
//delay (10);
}
gotoxy(3,1);textcolor(GREEN);cprintf("É");
gotoxy(3,21);textcolor(GREEN);cprintf("È");
gotoxy(79,1);textcolor(GREEN);cprintf("»");
gotoxy(79,21);textcolor(GREEN);cprintf("¼");
}
void menu()
{
nextscreen();
nextscreen2();
int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0,z;
gotoxy(30,2);textcolor(LIGHTRED);cprintf("Exercise VII");
gotoxy(30,5);textcolor(LIGHTGREEN);cprintf("WeLcomE!!");
gotoxy(26,6);textcolor(LIGHTRED);cprintf("\nSelect operation you like to Try!");
gotoxy(25,8);textcolor(YELLOW);cprintf("\n\t[A] for ADDITION");
gotoxy(25,9);textcolor(BLUE);cprintf("\n\t[B] for SUBTRACTION");
gotoxy(25,10);textcolor(CYAN);cprintf("\n\t[C] for MULTIPLICATION");
gotoxy(25,11);textcolor(RED);cprintf("\n\t[D] for DIVISION");
gotoxy(25,12);textcolor(GREEN);cprintf("\n\t[E] for Exit");
gotoxy(25,14);textcolor(YELLOW);cprintf("\nEnter your choice operation here:");
scanf("%s",&choice);

switch(choice)
{
case 'A':

clrscr();

nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(CYAN);cprintf("A] Addition");
gotoxy(25,6);textcolor(CYAN);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(CYAN);cprintf("Enter 2nd number:");
scanf("%d",&b);
sum=a+b;
gotoxy(25,10);textcolor(CYAN);cprintf("Sum of two number is: %d",sum);
gotoxy(25,12);textcolor(CYAN);cprintf("NicE onE!!\n");
gotoxy(25,14);textcolor(CYAN);cprintf("Do you want to try again,y/n?");
scanf("%s",&z);
menu();
getch();

break;
}

switch(choice)
{
case 'B': clrscr();
nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(YELLOW);cprintf("B] Subtraction");
gotoxy(25,6);textcolor(YELLOW);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(YELLOW);cprintf("Enter 2nd number:");
scanf("%d",&b);
sub=a-b;
gotoxy(25,10);textcolor(YELLOW);cprintf("Subtraction of two number is: %d",sub);
gotoxy(25,12);textcolor(YELLOW);cprintf("NicE onE!!");
gotoxy(25,14);textcolor(YELLOW);cprintf("Do you want to try again,y/n?");
scanf("%s",&z);
menu();
getch();

break;
}

switch(choice)
{
case 'C':
clrscr();
nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(BLUE);cprintf("C] Multiplication");
gotoxy(25,6);textcolor(BLUE);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(BLUE);cprintf("Enter 2nd number:");
scanf("%d",&b);
mul=a*b;
gotoxy(25,10);textcolor(BLUE);cprintf("Muliplication of two number is: %d",mul);
gotoxy(25,12);textcolor(BLUE);cprintf("NicE onE!!");
gotoxy(25,14);textcolor(BLUE);cprintf("Do you want to try again,y/n?");
scanf("%s",&z);
menu();
getch();

break;
}

switch(choice)
{
case 'D':
clrscr();
nextscreen();
nextscreen2();
gotoxy(25,5);textcolor(RED);cprintf("D] Division");
gotoxy(25,6);textcolor(RED);cprintf("Enter number:");
scanf("%d",&a);
gotoxy(25,8);textcolor(RED);cprintf("Enter 2nd number:");
scanf("%d",&b);
div=a/b;
gotoxy(25,10);textcolor(RED);cprintf("Division of two number is: %d",div);
gotoxy(25,12);textcolor(RED);cprintf("NicE onE!!");
gotoxy(25,14);textcolor(RED);cprintf("Do you want to try again,y/n?");
scanf("%s",&z);
menu();
getch();

break;
}



switch(choice)
{
case'E':

gotoxy(15,18);textcolor(LIGHTRED);cprintf("\n\nEnd of the program,Tinkchoi for browsing!! (-_-)");

}


}
void nextscreen2()

{
clrscr();
int a,b,x,y,z;

for(x=1;x<=77;x++)
{
gotoxy(2+x,1);textcolor(GREEN);cprintf("Í");
gotoxy(2+x,21);textcolor(GREEN);cprintf("Í");
}
for(y=1;y<=20;y++){
gotoxy(3,1+y);textcolor(GREEN);cprintf("º");
gotoxy(79,1+y);textcolor(GREEN);cprintf("º");
}
gotoxy(3,1);textcolor(GREEN);cprintf("É");
gotoxy(3,21);textcolor(GREEN);cprintf("È");
gotoxy(79,1);textcolor(GREEN);cprintf("»");
gotoxy(79,21);textcolor(GREEN);cprintf("¼");
for(a=1;a<=49;a++)
{
gotoxy(15+a,4);textcolor(MAGENTA);cprintf("¯");
gotoxy(15+a,17);textcolor(MAGENTA);cprintf("¯");
}
for(b=1;b<=14;b++)
{
gotoxy(16,3+b);textcolor(MAGENTA);cprintf("¯");
gotoxy(65,3+b);textcolor(MAGENTA);cprintf("® ");
}
}
void main()
{
clrscr();

nextscreen();
nextscreen2();
menu();
getch();

}

Saturday, February 14, 2009

EXER6 CS121

Photobucket
#include
#include


void main()
{ clrscr();
float grade,average,sum;
int a=0;

while(grade!=-1)
{ sum=sum+grade;
printf("\n\n_-_-_-_-_-_-_-_-_-_-_");
printf("\nEnter grade; -1 to exit");
scanf("%f",&grade);

if(grade==-1)
{printf("\n\n\n\t\t\t.,.,.,.,.,.,.,.,.,.,.,.");
printf("\n\t\t\tAverage is %.2f\n",average=sum/a);}
a++;
}
if(average>=95 && average<=100){ printf("\n\nRated of this average: A");} else if(average>=90 && average<=94){ printf("\n\nRated of this average: B");} else if(average>=89 && average<=90){
printf("\n\nRated of this average: C");}
getch();
}

Wednesday, February 11, 2009

EXER5 CS 121

Photobucket
#include
#include
#include

void main(){
clrscr();
int h,i,j,x,y,choice,X;

printf("\nEnter your favorite number:");
scanf("%d",&h);
printf("\nSelect pattern you like to appear!");
printf("\n\t[A] for Pattern 1");
printf("\n\t[B] for Pattern 2");
printf("\n\t[C] for Pattern 3");
printf("\n\t[D] for Pattern 4");
printf("\nEnter your choice Pattern here:");
scanf("%s",&choice);
switch(choice)
{
case 'A':
for(i=1,y=10;i<=h;i++,y++) { for(j=1,x=35;j<=i;j++,x++) { gotoxy(x,y); printf("*"); } } break; case 'B': for(i=1,y=10;i<=h;i++,y++) { for(j=1,x=35;j<=i;j++,x--) { gotoxy(x,y); printf("*"); } } break; case 'C': for(i=h,y=10;i<=h;i--,y++) { for(j=i,x=35;j>=1;j--,x++)
{
gotoxy(x,y);
printf("*");
}
}
break;

case 'D':
for(i=h,y=10;i>=1;i--,y++)
{
for(j=i,x=35;j>=1;j--,x--)
{
gotoxy(x,y);
printf("*");
}
}
break;
}
printf("\n\nYou got a nice pattern! ;)) \n\n made by:n\n ¯Jayson Madijanon ");
getch();
}

Exer4 CS121

Photobucket

#include
#include

int salary, years, x=0,bonus=0;
void main(){
clrscr();
printf("\nEnter Salary:");
scanf("%d", &salary);
printf("\nEnter Years of Service:");
scanf("%d", &years);
if (years==1){
bonus=salary*0.10;
x=salary+bonus;
printf("\nBonus: %d", bonus);
printf("\nTotal Salary: %d",x);
}
else if ((years<=5) && (years>=2)){
bonus=salary*0.20;
x=salary+bonus;
printf("\nBonus: %d", bonus);
printf("\nTotal Salary: %d",x);
}
else if ((years<=10) && (years>=6)){
bonus=salary*0.50 ;
x=salary+bonus;
printf("\nBonus: %d", bonus);
printf("\nTotal Salary: %d",x);
}
else if (years<=11){
bonus=salary*0.75;
x=salary+bonus;
printf("\nBonus: %d", bonus);
printf("\nTotal Salary: %d",x);
}
printf("\n\n\n\n\t\t\t\t\t\tCreated by: jayson cadena madijanon");
getch();
}

Exer3 CS121

Photobucket

#include
#include


void main(){
clrscr();
int choice,a,b,n,y,sum=0,sub=0,mul=0,div=0;

printf("W E L C O M E ! ! !");
printf("\nSelect operation you like to Try!");
printf("\n\t[A] for ADDITION");
printf("\n\t[B] for SUBTRACTION");
printf("\n\t[C] for MULTIPLICATION");
printf("\n\t[D] for DIVISION");
printf("\n\t[E] for Exit");
printf("\nEnter your choice operation here:");
scanf("%s",&choice);
switch(choice)
{
case 'A':
printf("Enter number:");
scanf("%d",&a);
printf("Enter another number:");
scanf("%d",&b);
sum=a+b;
printf("Sum of two number is: %d",sum);
break;

case 'B':
printf("Enter number:");
scanf("%d",&a);
printf("Enter another number:");
scanf("%d",&b);
sub=a-b;
printf("Sub of two number is: %d",sub);
break;

case 'C':
printf("Enter number:");
scanf("%d",&a);
printf("Enter another number:");
scanf("%d",&b);
mul=a*b;
printf("Mul of two number is: %d",mul);
break;

case 'D':
printf("Enter number:");
scanf("%d",&a);
printf("Enter another number:");
scanf("%d",&b);
div=a/b;
printf("Div of two number is: %d",div);
break;

case'E':
printf("\n\nEnd of the program,\nThank you very much!!!! ");


}
printf("\n\n\t\t\t\t\t\tCreated by: Jayson Madijanon");
getch();
}

Exer2 CS121

Photobucket

#include
#include

main()
{
clrscr();
printf("\n\n\t\t\t\tMy Autobiography ! ! \n\n\n");
printf("I am Jayson C.Madijanon\n17 years young,\nBorn on July 20,1991,a jolly person who always talk with sense and optimistic and idealistic\n");
printf("Im living at Puan , Davao City together with my family\nI graduated secondary level of education at Talomo National High School");
printf("\n\n\n\t\Thanks a Lot for viewing this!!");
printf("\n\n\n\n\t\t\t\t\t\tCreated by: Jayson Cadena Madijanon");
getch();
}