Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Functions with arguments but no return values

Posted By: Barrett Schmidt     Category: C Programming     Views: 6529

Functions with arguments but no return values.

Code for Functions with arguments but no return values in C Programming

/* prototypes */
void printline (char c); voidvalue (float, float, int); main( ) { float principal, inrate; int period; printf("Enter principal amount, interest"); printf(" rate, and period \n"); scanf("%f %f %d",&principal, &inrate, &period); printline('Z'); value(principal,inrate,period); printline('C'); } void printline(char ch) { int i ; for(i=1; i <= 52; i++) printf("%c",ch); printf("\n"); } voidvalue(float p, float r, int n) { int year ; float sum ; sum = p ; year = 1; while(year <= n) { sum = sum * (1+r); year = year +1; } printf("%f\t%f\t%d\t%f\n",p,r,n,sum); } Output Enter principal amount, interest rate, and period 5000 0.12 5 ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 5000.000000 0.120000 5 8811.708984 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
  
Share: 


Didn't find what you were looking for? Find more on Functions with arguments but no return values Or get search suggestion and latest updates.

Barrett Schmidt
Barrett Schmidt author of Functions with arguments but no return values is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!