Pages

Write A Program Of Sum of Ten Number Through Function.

Friday, 19 April 2013


#include<stdio.h>
#include<conio.h>
int mul(int );//function prototype
int main()
{
    int a,sum=0, num;
    printf("Enter last number: ");
       scanf("%d", &num);
       printf("sum is %d", mul(num));// function call which can pass the value to function definition
   
    getch();
}
int mul(int x)// function definition
{
    int sum=0, a;
    for(a=1;a<=x;a++)
       {
             sum=sum+a;
       }
 return sum;
}


 

Search Box

Most Reading

Contact Form

Name

Email *

Message *