Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    Default Pls help mga idol sa C programming


    tabang ko mga idol s ako assignment ang ako problem about sa salary sa first 48hrs niya maka sweldo siya og 50 ug mu lapas man og 48 ma pun an og 30 ang iya sweldo. bali mao na ni siya ang ako ge code

    Code:
    #include<stdio.h>
    void main ()
    
    
    {
    
    int NH,AD,OV;
    
    
    printf("Number of Hours: ");
    scanf("%d",&NH);
    if(NH<=48 )
    {
    AD=NH*50;
    printf("Salary: %d \n\n\n",AD);
    }
    else 
    {
    
    OV=NH*50+30;
    printf("\n\n\n Overtime Salary:%d \n\n\n",OV);
    
    }
    
    }
    sa first statement correct ko dibamga idol. pero sa else na murag kulangan ko nag libug ko kung unsa jud ang ako e ponu kay sa 48*50=2400, daun try nako 49=2480 sakto na, but then inig try nako sa 50=2530 ra siya imbis na 2560 wla na adan ug 30 na,, unsa ako kulang mga idol tabang pls

  2. #2

    Default Re: Pls help mga idol sa C programming

    compiler d i nako c++ mga idol

  3. #3

    Default Re: Pls help mga idol sa C programming

    Please correct me if I'm wrong.
    Wala mo gpa make ug functions?
    Sorry bro, wala koy c++ compiler.

    #include<stdio.h>
    void main(void)
    {
    float salary=50, OT=30;
    int NH;

    printf("Input number of hours worked: ");
    scanf("%d",&NH);

    salary *=NH; \\salary = salary*NH;
    if(NH>4
    salary+=OT;
    printf(" \n Salary: %.2f", salary);
    }

  4. #4

    Default Re: Pls help mga idol sa C programming

    Please correct me if I'm wrong.
    Wala mo gpa make ug functions?
    Sorry bro, wala koy c++ compiler.

    #include<stdio.h>
    void main(void)
    {
    float salary=50, OT=30;
    int NH;

    printf("Input number of hours worked: ");
    scanf("%d",&NH);

    salary *=NH; \\salary = salary*NH;
    if(NH>48 )
    salary+=OT;
    printf(" \n Salary: %.2f", salary);
    }

  5. #5

    Default Re: Pls help mga idol sa C programming

    bro ako g. try imo program pero same ra japun mo gwas inig input nako sa 50 2530 gihapun dapat 2560 wla man na adan og 30. ingon sad to amo instr. na mugamit me og if else statement

  6. #6

    Default Re: Pls help mga idol sa C programming

    based sa imu code, nag add ra ka og 30 kada human og times..
    dapat, naa ka'y limit sa 48 hours nga mag times siya og 50...

    then kung 50 hours,
    int a = 50-48;
    int b = a*80

    Atong i-matha-mata...
    50-48 = 2, right?
    2*80 = 160..

    160 + 48*50 = 2560

    mao importante ang algorithm tungod kay simple math ra man na and wa na sa programming nimo nor sa programming language..

  7. #7

    Default Re: Pls help mga idol sa C programming

    Code:
    #include<stdio.h>
    void main (){
    int NH=0,OT=0,SALARY=0,DUMMY=0;
    int RRATE=50, OTRATE=80;
    
    printf("Number of Hours: ");
    scanf("%d",&NH);
    if(NH<=48 ){
         SALARY=NH*RRATE;
         printf("Salary: %d \n\n\n",SALARY);
    }else {
         //Minus the total hours to regular hours which is 48 hours
         OT=NH-48; 
         //create a dummy variable
         DUMMY=OT*OTRATE;
         //Calculate the regular rate to regular hours
         SALARY=NH*48;
         //Add the dummy OTRate to Regulare Rate.
         SALARY=SALARY+DUMMY;
         printf("\n\n\n Total Salary:%d \n\n\n",SALARY);
    }
    }
    Not sure if it works kay wala ko'y compiler.. but try this..

  8. #8

    Default Re: Pls help mga idol sa C programming

    bro ako siya gi try pero sayup japun ok siya inig input nako 50=2560 ang mogwas pero inig 51=2688 na,,,ing ani man gud ni siya everytime mag add ka og 1hr 80 ang ma puno example. input ka ug 49=2480 50=2560 51=2640 52=2720 and so on.. dpat 80 jud ang mapunu galisud jud ko ani mga bro,, help me pls,, ge try na naq tanan...

  9. #9

    Default Re: Pls help mga idol sa C programming

    Kasabut mi sa imu pasabut bro..

    anyways, try ni balik...

    Code:
    #include<stdio.h>
    void main (){
    int NH=0,OT=0,SALARY=0,DUMMY=0;
    int RRATE=50, OTRATE=80;
    
    printf("Number of Hours: ");
    scanf("%d",&NH);
    if(NH<=48 ){
         SALARY=NH*RRATE;
         printf("Salary: %d \n\n\n",SALARY);
    }else {
         //Minus the total hours to regular hours which is 48 hours
         OT=NH-48; 
         //create a dummy variable
         DUMMY=OT*OTRATE;
         //Calculate the regular rate to regular hours
         SALARY=48*RRATE;
         //Add the dummy OTRate to Regulare Rate.
         SALARY=SALARY+DUMMY;
         printf("\n\n\n Total Salary:%d \n\n\n",SALARY);
    }
    }
    nasayup ko sa SALARY=NH*48...
    Dapat, SALARY=48*RRATE d.i ni...

    Changed already...

  10. #10

    Default Re: Pls help mga idol sa C programming

    salamat kayo bro sakto na jud siya ... tnx jud ahmm kato ako gi program sayup jud to siya?

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. Replies: 0
    Last Post: 11-12-2008, 06:19 PM
  2. pls help mga bro's
    By jayspike in forum Computer Hardware
    Replies: 13
    Last Post: 05-19-2008, 02:37 PM
  3. pls help. finding ISP sa rural area..
    By nonoyantoine in forum Networking & Internet
    Replies: 19
    Last Post: 05-08-2008, 11:37 PM
  4. Assigning IP Address problem pls help mga bossing...
    By kerman in forum Networking & Internet
    Replies: 12
    Last Post: 12-02-2007, 05:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top