mihaispr
Administrator
Inregistrat: acum 17 ani
Postari: 2142
|
|
//Pb1. Calculati (pow(x,4)+4*x-3)/4
#include<stdio.h> #include<conio.h> #include<math.h>
float x,e; void main(void)
{clrscr(); printf("x=" ); scanf("%f",&x); e= (float)(pow(x,4)+4*x-3)/2; printf("E=%f",e); getch(); }
//Pb2. Calculati expresia sqrt(a+6) pt a<0 si (pow(a,3)-2)/(a-3) pt a>=0
#include<stdio.h> #include<conio.h> #include<math.h>
int a; float e; void main(void)
{clrscr(); printf("a=" ); scanf("%d",&a); if (a<0) if (a>=-6) {e=sqrt(a+6); printf("E=%f",e); } else printf("Expresia nu are solutii" ); else if (a!=3) {e= (float)(pow(a,3)-2)/(a-3); printf("E=%f",e); } else printf("Expresia nu exista" ); getch(); }
//Pb3. Calculati expres. sina-cosa pt a>0;12 pt a=0 si pow(a,2)-3*a+2 pt a<0//
#include<stdio.h> #include<conio.h> #include<math.h>
int a; float e; void main(void)
{clrscr(); printf("a=" ); scanf("%d",&a); if (a>0) {e=sin(a)-cos(a); printf("E=%f",e); } else if(a==0) {e=12; printf("E=%f",e); } else if (a<0) {e=pow(a,2)-3*a+2; printf("E=%f",e); } getch(); }
//Pb4. Calculati [2*(a+b)-(ab-bc)]/pow(a,2)-pow(b,2)
#include<stdio.h> #include<conio.h> #include<math.h>
int a,b,c; float f;
void main(void) {clrscr(); printf("a=" );scanf("%d",&a); printf("b=" );scanf("%d",&b); printf("c=" );scanf("%d",&c); f= (2*a+2*b)-(a*b-b*c)/pow(a,2)-pow(b,2); printf("Fractia=%f",f); getch(); }
//Pb5. Calculeaza urmatorul raport (2*(a+1))-(3*b-4)/(16*a-16*b)
#include<stdio.h> #include<conio.h> #include<math.h>
int a,b; float f;
void main(void) {clrscr(); printf("a=" );scanf("%d",&a); printf("b=" );scanf("%d",&b); f= (2*(a+1))-(3*b-4)/(16*a-16*b); printf("Fractia=%f",f); getch(); }
//Pb6. Calculati x+1 pt.x<=4 si 2*x-1 pt.x>4
#include<stdio.h> #include<conio.h> #include<math.h>
int x; float e;
void main(void) {clrscr(); printf("x=" );scanf("%d",&x); if (x<=4) {e=x+1; printf("Exp=%f",e); } else {e=2*x-1; printf("Exp=%f",e); } getch(); }
/*Pb7. De alcătuit un program ce calculează valoarea lui a şi b.
unde a=[2*co(x-pi/6)]/0.5+siny] si b=1+ z/(3+z/5)
*/
#include<math.h> #include<conio.h> #include<stdio.h> main() { float x,y,a,b,z,pi=3.14; printf("introduceti x,y,z:\n" ); scanf("%f%f%f",&x,&y,&z); a=2*cos(x-pi/6)/(1/2+pow(sin(y),2)); b= (1+pow(z,2))/(3+pow(z,2)/5); printf("a=%f,b=%f",a,b); getch(); }
/*Pb.8 Alcatuiti programul ce calculeaza sistemul de ecuatii:
y= a*t*ln(t) pt. 1<t<2 1 pt. t<1 e*cosb*t pt. t<2 */
#include<conio.h> #include<stdio.h> #include<math.h>
main() { float a,b,t,y; clrscr(); printf("introduceti variabilele" ); scanf("%f%f%f",&a,&b,&t); if(t>=1&&t<=2) y=a*pow(t,2)+log(t); else if(t<1) y=1; else y=exp(a*t)*cos(b*t); printf("%f",y); }
|
|