You are on page 1of 1

#include <iostream.

h>
#include <math.h>
main(){
float a,b,c,d,x;
int d1,d2,n,m;
X:
cout<<"Enter Probability of Raining Today: ";
cin>>a;
if(a>1){
cout<<"pl. enter value less than 1\n";
goto X;
}
b=1-a;
cout<<"Enter value of alpha: ";
cin>>x;
cout<<"Enter Initial Date: ";
cin>>d1;
cout<<"Enter next date for probability: ";
cin>>d2;
n=d2-d1;
//x=(180*x*7)/22;
c=cos(x);
d=sin(x);
cout<<"a = "<<a<<" b = "<<b<<"\n";
cout<<"Cos x = "<<c<<" and Sin x = "<<d<<" n= "<<n<<"\n";
float f1=c,f2=d,f3=d,f4=c,f11,f12,f21,f22;
for(m=1;m<n;m++){
f11=(f1*c)+(d*f3);
f21=(c*f2)+(d*f4);
f12=(d*f1)+(c*f3);
f22=(d*f2)+(c*f4);
f1=f11;
f2=f21;
f3=f12;
f4=f22;
}
float p1,p2;
p1=(f1*a)+(f2*b);
p2=(f3*a)+(f4*b);
cout<<"Probability of rain: "<<p1<<"\n";
cout<<"Probability of no rain: "<<p2;
}

You might also like