#include<stdio.h>
#include<conio.h>
#include<math.h>
float fun(float a)
{
float b;
b=a*a-4*a-10; /*just change the equation according to your wish */
return(b);
}
float main()
{
float x1,x2,x3,f1,f2,f3,e;
printf("enter the values of x1 and x2");
scanf("%f",&x1);
scanf("%f",&x2);
printf("x1\t x2\t x3\t f1\t f2\t");
do
{
f1=fun(x1);
f2=fun(x2);
x3=((x1*f2)-(x2*f1))/(f2-f1);
e=fabs((x3-x2)/(x3));
x1=x2;
x2=x3;
printf("\n%f\t %f\t %f\t %f\t %f\t",x1,x2,x3,f1,f2);
}
while(e>0.001);
getch();
}
#include
ReplyDelete#include
void main()
{
FILE *o ,*s;
int g,h,j,i,su=0;
printf("enter lower number range\n");
scanf("%d",&g);
printf("enter higher number range\n");
scanf("%d",&h);
for(i=g;g<=h;g++)
{
su=g+su;
}
s=fopen("c.txt","w");
fprintf(s,"%d",su);
fclose(s);
printf("%d",su);
getch();
}
#include
ReplyDelete#include
int sum()
{
int g,h,j,i,su=0;
printf("enter lower number range\n");
scanf("%d",&g);
printf("enter higher number range\n");
scanf("%d",&h);
for(i=g;g<=h;g++)
{
su=g+su;
}
return(su);
};
void main()
{
FILE *o ,*s;
int g,h,j,i,su=0;
su=sum();
s=fopen("c.txt","w");
fprintf(s,"%d",su);
fclose(s);
printf("%d",su);
getch();
}
it's not c++ you dickhead..
ReplyDeleteyour fucking dhoti indian... this is fucking c program...asshole
DeleteIts not f*cking working you a**holes!!!!
ReplyDeletewhy the hell dont u try then :P :3
Delete