Thursday, March 23, 2017

Legal Age Checker in Turbo Pascal

Here is a simple program that will check if the given age of the user is already legal or  not let us assume the legal is 18 years old it uses if else statement in Pascal to check. The code is very easy to understand and use. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

{Written By: Mr. Jake R. Pomperada, MAED-IT }
{Date : March 23, 2017    Thursday            }
{Metro Manila, Philippines                  }
{jakerpomperada@yahoo.com and jakerpomperada@gmail.com }

Program legal_age_checker;

Uses WinCrt;

Var Age : Integer;

Begin
clrscr;
 Age := 0;

 writeln('LEGAL AGE CHECKER IN PASCAL');
 writeln;
 Write('Enter Your Age : ');
 Readln(Age);

   If (Age>=18) then
   Begin
     Writeln;
     Write('You are already an Adult at the age of ',age,'.');
   End
  Else
    Begin
        Writeln;
        Write('You are still a Minor at the age of ',age,'.');
    End;
 writeln;
 writeln;
 Writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.

Odd and Even Number Checker in Turbo Pascal

Here is a sample program that will ask the user to give a number and then our program will determine if the given number is an odd or even number using Pascal as our programming language. I am using Turbo Pascal for Windows in this sample program. Thank you.


My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

{ Written By: Mr. Jake R. Pomperada, MAED-IT                           }
{ Date : March 23, 2017    Thursday                                               }
{ Metro Manila, Philippines                                                              }
{ jakerpomperada@yahoo.com and jakerpomperada@gmail.com }

Program even_odd_numbers;

Uses WinCrt;

Var N, R : Integer;

Begin
clrscr;
 N := 0;
 R := 0;

 writeln('EVEN AND ODD NUMBER CHECKER IN PASCAL');
 writeln;
 Write('Give a Number : ');
 Readln(N);
 R := (N MOD 2);
   if (R=0) then
   Begin
     Writeln;
     Write('The given number ' ,n,' is EVEN number.');
   End
  Else
    Begin
        Writeln;
        Write('The given number ' ,n,' is ODD number.');
    End;
 writeln;
 writeln;
 Writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.


Wednesday, March 22, 2017

Side Pyramid Image in C

Hello there in this article I would like to share with you a sample program that will display side pyramid in C. The code uses two for loop statements to create the side pyramid image in C. I hope you will like my work. I am using CodeBlocks as my text editor and Dev C++ as my C/C++ compiler in this sample program. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

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

/* Side Pyramid Image                                              */
/* Written By: Mr. Jake R. Pomperada, MAED-IT  */
/* March 22, 2017                                                  */

int main()
{

    int size=5;
    int a=0,b=0;

     printf("SIDE PYRAMID IMAGE ");
     printf("\n\n");
     for (a=size; a>=-size; a--) {
        for (b=size; b >= abs(a); b--) {
            printf("*");
        }
      printf("\n");
     }
    printf("\n\n");
    printf("End of Program");
    printf("\n\n");
}



Sunday, March 19, 2017

Student Grade Solver Using Pointers in C++

A simple program that I wrote using C++ to compute the student grades using functions and pointers as my data structure. The code is very simple and easy to understand I am using CodeBlocks as my text editor and Dev C++ as my C++ compiler in this sample program. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Program Listing


#include <iostream>
#include <iomanip>

 using namespace std;

float X_Prelim=0.00, X_Midterm=0.00, X_Endterm=0.00;

 float solve_grade(float *prelim,  float *midterm, float *endterm)
 {
     float compute_grade =0.00;
     bool  result;
     compute_grade = (*prelim * 0.30) + (*midterm * 0.30)
                     + (*endterm * 0.40);

    if (compute_grade >= 75.00) {
        result = true;
    }
    else {
        result = false;
    }

    switch(result) {

     case   true : cout << "\nThe Student Passed the Subject.";
                   break;
      case   false : cout << "\nThe Student Failed the Subject.";
                     break;
      default      : cout << "Sorry Invalid Grade !!!";
    }
     return(compute_grade);
 }

 void start()
 {

     cout << "\t\t GRADE SOLVER VERSION 1.0 USING POINTERS";
     cout << "\n\n\t       Created By: Mr. Jake R. Pomperada, MAED-IT";
     cout << "\n\n";
     cout << "Enter Prelim Grade  ==> ";
     cin >> X_Prelim;
     cout << "Enter Midterm Grade ==> ";
     cin >> X_Midterm;
     cout << "Enter Endterm Grade ==> ";
     cin >> X_Endterm;
     cout << "\n";
     cout << fixed;
     cout << setprecision(2);
     cout << "\nYour Final Grade is " <<
          solve_grade(&X_Prelim,&X_Midterm,&X_Endterm) << ".";

     cout << "\n\n";
     system("PAUSE");
 }

main() {

    start();
}


Total Sum of Values in Turbo Pascal

Here is a sample program using one dimensional array to ask the user to give five numbers and then our program will compute the total sum of the five numbers being given by our user. I am using Turbo Pascal for Windows as my Pascal compiler in this sample program.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

{Written By: Mr. Jake R. Pomperada, MAED-IT }
{Date : March 19, 2017    Sunday            }
{Metro Manila, Philippines                  }
{jakerpomperada@yahoo.com and jakerpomperada@gmail.com }

Program One_Dimensional;
Uses WinCrt;

Type

List_Array = Array[1..5] of Integer;

var val : List_Array;

    b,sum   : Integer;

Begin
clrscr;
 writeln('TOTAL SUM OF VALUES IN PASCAL');
 writeln;
 for b := 1 to 5 Do
  Begin
     Write('Give value in item no. ' ,b, ' : ');
     Readln(val[b]);
  End;
 Writeln;
 Write('List of Given Values');
 Writeln;
 Writeln;
   for b := 1 to 5 Do
  Begin
    Write(' ',val[b],' ');
    sum := sum + val[b];
  End;
 writeln;
 writeln;
 write('The total sum of values is ' ,sum,'.');
 writeln;
 Writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.



One Dimensional Array in Turbo Pascal

In this article I would like to share with you a sample program that will demonstrate how to use one dimensional array using Pascal as our programming language. What does the program will do is to ask the user to give five numbers and then our program will display the list of five numbers given by our user. The code is very simple and easy to understand. I am using Turbo Pascal for Windows as my pascal compiler in this sample program.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Sample Program Output


Program Listing

{Written By: Mr. Jake R. Pomperada, MAED-IT }
{Date : March 19, 2017    Sunday            }
{Metro Manila, Philippines                  }
{jakerpomperada@yahoo.com and jakerpomperada@gmail.com }

Program One_Dimensional;
Uses WinCrt;

Type

List_Array = Array[1..6] of Integer;

var val : List_Array;

    b   : Integer;

Begin
clrscr;
 writeln('ONE DIMENSIONAL IN PASCAL');
 writeln;
 for b := 1 to 5 Do
  Begin
     Write('Give value in item no. ' ,b, ' : ');
     Readln(val[b]);
  End;
 Writeln;
 Write('List of Given Values');
 Writeln;
   for b := 1 to 5 Do
  Begin
    Write(' ',val[b],' ');
  End;
 writeln;
 Writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.



Friday, March 17, 2017

Yard To Feet Converter in Turbo Pascal

Here is a sample program that will ask the user to give a value in yard and then our program will convert the given value in yard into feet equivalent using Pascal as our programming language. I use a function to do the conversion from yard to feet by multiplying the value in yard by 3 because 1 yard is equivalent to 3 feet. I hope you will find my work useful. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

Program yard_feet_converter;
Uses WinCrt;

var val_1, solve : integer;

Function convert_feet(a : integer) : integer;
Begin
   convert_feet := (a*3);
End;


Begin
clrscr;
 writeln('YARD TO FEET CONVERTER IN PASCAL');
 writeln;
 Write('Give a value in yard : ');
 Readln(val_1);

 solve:= convert_feet(val_1);

 writeln;
 write('The equivalent value of ' ,val_1, ' yard is ',solve,' feet(s).');
 writeln;
 writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.




Sum of Three Numbers in Pascal

In this article I would like to share with you a sample program that I wrote using Pascal as my programming language that will ask the user to give three numbers and then our program will compute the total sum of three numbers using functions in Pascal. The compiler that I am using in this sample program is Turbo Pascal For Windows. The code is very simple and easy to understand.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

Program Sum_Number;
Uses WinCrt;

var val_1,val_2,val_3, add : integer;

Function sum(a,b,c : integer) : integer;
Begin
   sum := (a+b+c);
End;


Begin
clrscr;
 writeln('SUM OF THREE NUMBERS IN PASCAL');
 writeln;
 Write('Enter First Number : ');
 Readln(val_1);

 Write('Enter Second Number : ');
 Readln(val_2);

 Write('Enter Third Number  : ');
 Readln(val_3);
   
 add := sum(val_1,val_2,val_3);

 writeln;
 write('The sum of ',val_1,' ',val_2, ' and ',val_3, ' is ' ,add,'.');
 writeln;
 writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.


Sum and Product of Two Numbers in Turbo Pascal

In this article I would like to share with you a sample program that will ask the user to give two numbers and then our program will compute the sum and product of the two given numbers using Turbo Pascal for Windows as our compiler. The code uses function to return the computed value. I hope you will find my work useful. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.







Sample Program Output



Program Listing

Program Square_Number;
Uses WinCrt;

var val_1,val_2, add,multiply  : integer;

Function sum(a,b : integer) : integer;
Begin
   sum := (a+b);
End;

Function product(a,b : integer) : integer;
Begin
   product := (a*b);
End;

Begin
clrscr;
 writeln('SUM AND PRODUCT OF TWO NUMBERS IN PASCAL');
 writeln;
 Write('Enter First Number : ');
 Readln(val_1);

 Write('Enter Second Number : ');
 Readln(val_2);
   
 add := sum(val_1,val_2);

 multiply := product(val_1,val_2);
  
 writeln;
 write('The sum of ',val_1, ' and ' ,val_2, ' is ' ,add,'.');
 writeln;
 write('The product of ',val_1, ' and ' ,val_2, ' is ' ,multiply,'.');
 writeln;
 writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.




Square a Number in Turbo Pascal

Here in this article I would like to share with you a sample program that I wrote using Turbo Pascal for Windows to ask the user to give a number and then our program will compute the square value being provided by our user. The program uses functions in Pascal to square the number by the user given.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing


Program Square_Number;
Uses WinCrt;

var val, solve  : integer;

Function square(a : integer) : integer;
Begin
   Square := (a*a);
End;


Begin
clrscr;
 writeln('SQUARE A NUMBER IN PASCAL');
 writeln;
 Write('Give a Number : ');
 Readln(val);

 solve := square(val);

 writeln;
 write('The Square value of ' ,val, ' is ' ,solve,'.');
 writeln;
 writeln;
 writeln('  END OF PROGRAM  ');
readln;
End.



Sunday, March 12, 2017

Square and Cube Number in C

In this article I would like to share with you a program that uses for loop statement in  C to generate square and cube number values in C. The code is very simple and easy to understand. I am using CodeBlocks as my text editor and Dev C++ as my C and C++ compiler.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing


#include <stdio.h>

int num_value=0;

int main()

{
    printf("\t  SQUARE AND CUBE NUMBER IN C");
    printf("\n\n");
    printf("NUMBER     SQUARE      CUBE\n");
    printf("======     ======      ===== ");
    printf("\n\n");
     for (num_value=1; num_value<=12; num_value++)
     {
         printf("%3d       %4d       %6d\n",num_value,num_value*num_value,num_value*num_value*num_value);
     }
    printf("\n\n");
    printf("\t End of Program ");
    printf("\n\n");
}

Initializer Outside the For Statement in C

In this article I would like to share with you a sample program that will display a series of even numbers using for loop statement in C. The difference in this program is that the initializer is outside the for loop statement in C. The code is very short and easy to understand.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing


#include <stdio.h>

int main()
{
    int counter=0;
    counter = 2;

    printf("\tInitializer Outside the For Statement in C");
    printf("\n\n");
    for( ; counter <=40; counter = counter +2)
    {
        printf(" %d ",counter);
    }
    printf("\n\n");
    printf("\t End of Program ");
    printf("\n\n");
}