Tuesday, 18 October 2011

example page 93 # 2

0 comments
#include<stdio.h>
#include<conio.h>
#define s scanf
#define p printf

int main()
{
    int M, N, Z, H;
    M= 6;
    N= 0;
    for(H =1; H <= M; H++)
    {
          Z = 2 * H ;
          N = N + 3;
          p("H = %d\n", H);
          p("z = %d\n", Z);
          p("n = %d\n", N);
         
          }
          getch();
          return 0;
          }

Review Program ni Sir!

0 comments
#include<stdio.h>
#include<con

int x,y,z,m;

int main()
{
printf("Enter Number: ");
scanf("%d",&y);
printf("Enter another Number: ");
scanf("%d",&z);

for(x = 1; x <= y; x++)
{
m = y * z;
printf("%d x %d = %d\n",y,z,m);

}
getch();
return 0;
}

Conditional (GRADE)

0 comments
#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf
int grade;
int main()
{


    p("Enter Grade of Student: ");
    s("%d",&grade);
   
    if(grade >= 60)
    p("You Pass It!!");
    else
    p("Sorry you failed!");
    getch();
    return 0;
}

Thursday, 13 October 2011

A program that will get the average of all intergers from 1 - 10 using do-while loop

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

int main()
{

int x, sum;
float average;

{
     sum= 0;
     x= 1;
     do
     {
           x++;
          sum = sum + x;
        
          }while (x<=10);
          average = sum / 10.00;
          printf("The Computed average is %.2f\n",average);
          }
          getch();
          return 0;
          }

IF TOPC

0 comments
#include<stido.h>
#include<conio.h> 
int main(){
       int x,y;
       printf("Enter value for x :");
       scanf("%d",&x);
       printf("Enter value for y :");
       scanf("%d",&y);
       if ( x > y ){
               printf("X is large number - %d\n",x);
       }
       else{
               printf("Y is large number - %d\n",y);
       }
       return 0;
getch(); 
 
}

TOPIC NEW

0 comments
#include
#include

int main()
{
int i,y;
printf("Enter Number: ");
scanf("%d",&y);
for (i=0; i<=y; i+=2)
{
printf ("%d\n",i);
}

getch();
return 0;
}

Wednesday, 12 October 2011

#3.PAGE 81

0 comments
#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf


        int main()
        {
            int hw, hr, pong;
           


            p("Enter hours worked for the week:");
            s("%d",&hw);
            p("Enter the hourly rate:");
            s("%d",&hr);
           
            if(hw > 45)
            {
            pong = (hw * hr) - 500;
            }
           
        else
            {
                 if (hw > 40 && hw <= 45)
           
            pong = (hw * hr) - 250;
            }
     
            {
            if(hw > 35 and hw <=40)
           
           
            pong = (hw * hr) - 150;
            p("\nYour Total salary is %d",pong);
            }
           
       
           
           
        getch();
        return 0;
        }