Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- four_functions.c
- Task:
- https://www.facebook.com/photo/?fbid=873946883160845&set=gm.1860810587411116
- From Arslan Jadoon
- https://www.facebook.com/groups/177292205762971/user/100016366244425/
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- #include <string.h>
- char* function1_string( char text[100], int i1, float f2, double d3 )
- {
- sprintf(text, "\n Result is %f \n", i1 + f2 + d3 );
- return text;
- }
- int function2_int_square( int x1 )
- {
- return (x1*x1);
- }
- float function3_float_product( int x1, float x2 )
- {
- return(x1*x2);
- }
- double function4_double_division( int x1, float x2, double x3)
- {
- return( (double)(x1+x2/x3) );
- }
- int main(void)
- {
- char var_string[100];
- int var_int=1;
- float var_float=2.0;
- double var_double=3.0;
- printf("\n %s \n", function1_string( var_string,
- function2_int_square(var_int),
- function3_float_product(var_int, var_float),
- function4_double_division(var_int, var_float, var_double) ) );
- return 0;
- } // main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement