1.#include <stdio.h>
double f1(double x)
{ return x*x; }
double f2(double x, double y)
{ return x*y; }
/**********found**********/
__1__ fun(int i, double x, double y)
{ if (i==1)
/**********found**********/
return __2__(x);
else
/**********found**********/
return __3__(x, y);
}
void main()
{ double x1=5, x2=3, r;
r = fun(1, x1, x2);
r += fun(2, x1, x2);
printf("\nx1=%f, x2=%f, x1*x1+x1*x2=%f\n\n",x1, x2, r);
}
2.#include <conio.h>
#include <stdio.h>
/*************found**************/
double fun(char *s,char *t)
{
int s1=0,t1=0;
char *ss,*tt;
ss=s;
tt=t;
while(*ss)
{
s1++;
/*************found**************/
(*ss)++;
}
while(*tt)
{
t1++;
/*************found**************/
(*tt)++;
}
if(t1>s1)
return t;
else
return s;
}
void main()
{
char a[80],b[80];
printf("\nEnter a string : ");
gets(a);
printf("\nEnter a string again: ");
gets(b);
printf("\nThe longer is :\n\n%s\n", fun(a,b));
}
3.#include <stdio.h>
#include <string.h>
#define N 80
void fun (char *w,int m)
{
}
void main()
{
FILE *wf;
char a[N]= "ABCDEFGHIJK",b[N]= "ABCDEFGHIJK";
int m;
printf("The origina string :\n");
puts(a);
printf("\n\nEnter m: ");
scanf("%d",&m);
fun(a,m);
printf("\nThe string after moving :\n");
puts(a);
printf("\n\n");
/******************************/
wf=fopen("out.dat","w");
fun(b,3);
fprintf(wf,"%s",b);
fclose(wf);
/*****************************/
}