Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Functions with no arguments and no return values

Posted By: Adel Fischer     Category: C Programming     Views: 8973

Functions with no arguments and no return values.

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

/* Function declaration */
void printline (void); voidvalue (void); main() { printline(); value(); printline(); } /* Function1: printline( ) */
void printline(void) /* contains no arguments */
{ int i ; for(i=1; i <= 35; i++) printf("%c",'-'); printf("\n"); } /* Function2: value( ) */
voidvalue(void) /* contains no arguments */
{ int year, period; float inrate, sum, principal; printf("Principal amount?"); scanf("%f", &principal); printf("Interest rate? "); scanf("%f", &inrate); printf("Period? "); scanf("%d", &period); sum = principal; year = 1; while(year <= period) { sum = sum *(1+inrate); year = year +1; } printf("\n%8.2f %5.2f %5d %12.2f\n", principal,inrate,period,sum); } Output ----------------------------------- Principal amount? 5000 Interest rate? 0.12 Period? 5 5000.00 0.12 5 8811.71
  
Share: 


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

Adel Fischer
Adel Fischer author of Functions with no arguments and 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!