• Home
  • Disclaimer
  • Privacy Policy
  • Contact Us

Any Coding Here

providing coding tutorial for learning and sharing experiences

Select Menu
  • Home
  • Desktop Programming
    • C
    • Visual Basic
    • Java
    • Phyton
  • Web programming
    • HTML
    • PHP
    • Java Script
    • Perl
    • Responsive Cek
  • Sitemap
  • Static Page
  • Error Page
Home » C LANGUAGE » DESKTOP » example problems statement for:C Language

Monday, 16 November 2015

example problems statement for:C Language

dimas mu
Add Comment
C LANGUAGE, DESKTOP
Monday, 16 November 2015
example problems statement for:C Language
example problems statement for:C Language
someone invested $ 100 in a deposit account with an interest rate of 5%. It is assumed that all the flowers are combined with investment capital in the account, calculate and show the amount of money in the account at the end of each year for 10 years.

use the formula:
a = p (1 + r)²
P = the initial amount of capital invested
R = annual interest rate
n = number of years
a = the amount of money in the deposit at the end of year n

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

int main(void){
double a;
double P = 100;
double r = .05;
int year;
printf("%4s%21s\n","Year","Deposit");
for( year = 1 ;year <= 10; year++){
    a = P * pow(1.0 + r, year);
    printf("%4d%21.2f\n",year,a);
}
return 0;
}



double a;
double P = 100;
double r = .05;
"double" here has the same type with the "float". but the memory allocation "double" has a larger memory allocation from the "float".

 printf("%4s%21s\n","Year","Deposit");
 
"% 4s and %21s" is used to issue a letter that has been called by printf "4s" means to display the "string" with a wide field of "4" to explain that the value to be displayed is at position "4" in the execution of the program.

 a = P * pow(1.0 + r, year); 
Pow (1.0 + r, year) This program is used to raise to "1.0 + r" with the number of years.
EXAMPLE
#include <stdio.h>
#include <math.h>

int main(void){
int a = 2;
int b = 3;
int raise;
raise = pow(a,b);
printf("%d",raise);
return 0;
}
 
Like this article? Please Share: Facebook Twitter Google+
0 comments to "example problems statement for:C Language"

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Entri Populer

  • Pengertian dan Kegunaan Bahasa Pemrograman PHP
    Pengertian dan Kegunaan Bahasa Pemrograman PHP
    Pengertian dan Kegunaan Bahasa Pemrograman PHP Pemrograman PHP ,merupakan bahasa pemrograman untuk web yang digunakan untuk membuat skri...
  • Membuat Php Baru
    Membuat Php Baru
    Membuat Php Baru
  • Contoh Pembuatan StringMatching Bahasa C
    Contoh Pembuatan StringMatching Bahasa C
  • create a canvas in:HTML5
    create a canvas in:HTML5
    create a canvas in:HTML5 canvas on the "HTML5" is used to draw on a web page. the canvas, we can include 2D or 3D objects into...
  • introducing visual basic programming
    introducing visual basic programming
    What Is Visual Basic Visual Basic is one programming language developed by Microsoft since 1991 evolved form the earlier DOS version cal...
  • Add Two Integer:C Language
    Add Two Integer:C Language
    Add Two Integer:C Language add two integer in c language is one of the simplest program in this language.The discussion today we will t...
  • sample program "FOR":C Language
    sample program "FOR":C Language
    sample program for:C Language on the discussion today I will give an example of a simple program using a command (for). The first exa...
  • Apa itu Pemrograman Java
    Apa itu Pemrograman Java
    Apa itu Pemrograman Java Java merupakan pemrograman Berorientasi objek (PBO) yang dikembangkan oleh Sun Microsystem pada tahun 90-an.Bah...
  • example problems statement for:C Language
    example problems statement for:C Language
    example problems statement for:C Language someone invested $ 100 in a deposit account with an interest rate of 5%. It is assumed that al...
  • repost
    repost
    1 2 3 4 5 6 7 8 <html> <head> <title> .::Title::. </title> </head> <body> section contents ...

Labels

  • C LANGUAGE
  • DESKTOP
  • HTML
  • JAVA
  • PHP
  • VISUAL BASIC
  • WEB PROGRAMING
Powered by Blogger.

Blog Archive

  • ►  2017 (1)
    • ►  February (1)
  • ►  2016 (5)
    • ►  December (2)
    • ►  November (3)
  • ▼  2015 (7)
    • ▼  November (7)
      • create a canvas in:HTML5
      • a first step coding HTML5:HTML 5
      • examples of plural selection switch statement:C La...
      • example problems statement for:C Language
      • sample program "FOR":C Language
      • introducing visual basic programming
      • Add Two Integer:C Language

Labels

  • C LANGUAGE
  • DESKTOP
  • HTML
  • JAVA
  • PHP
  • VISUAL BASIC
  • WEB PROGRAMING

About Me

dimas mu
View my complete profile
Copyright 2015 Any Coding Here - All Rights Reserved
Template By Jenny Psychicfio Distributed by Kaizentemplate.