include<stdio.h>

main() { int n,year,choice=0; float val,tag,deprec; while(choice!=4) { printf("\nMethod:(1-Sl 2-DDB 3-SYD 4-END\n\n"); scanf("%d",&choice); if(choice >=1 && choice<=3) { printf("Original Value: "); scanf("%f",&val); printf("\nNo of years : "); scanf("%f",&n); } switch(choice){ { case 1: printf("\nStraight line method: \n\n"); deprec=val/n; val-=deprec; printf("\nEnd of the year %2d",year); printf(" \nDeprecation: %7.2f",deprec); printf(" \ncurrent value: %8.2f\n",val); }

    break;

    case 2:
        printf("\nDouble Decline Method: \n\n");
        for(year=1;year<=n;++year){
        deprec=2*val/2;
        val-=deprec;
         printf("\nEnd of the year %2d",year);
        printf(" Deprecation %7.2f",deprec);
        printf(" \ncurrent value: %8.2f",val);
        }
break;
    case 3:
        printf("\nSum of Year:\n\n");
        tag=val;
        for(year=1;year<=n;++year){
        deprec=(n-year+1)*tag/(n*(n+1)/2);
        val-=deprec;
         printf("\nEnd of the year %2d",year);
        printf(" Deprecation %7.2f",deprec);
        printf(" \ncurrent value: %8.2f",val);
        }

        break;
    case 4:
        printf("\nGoodbye !");
        break;
    default:
        printf("\nincorrect data entry,please try again");

} } }

asked 09 Jul '17, 14:20

suhel007's gravatar image

suhel007
111

need help to solve this problem, the iteration is not working

(09 Jul '17, 14:22) suhel007

ভাই সম্পুর্ণ কোড টা ভালো করে লিখেন । এভাবে কোড লিখলে ভালো মতো বুঝা যায় না ।

(06 Aug '17, 21:05) Return_Zero
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×54

question asked: 09 Jul '17, 14:20

question was seen: 463 times

last updated: 06 Aug '17, 21:05