Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<math.h>
- int main()
- { int i;
- float y,a,b,n,x[11],s,k;
- k=0;
- s=0;
- for(i=1;i<11;i++)
- {
- printf("Kerem a vektor elemeit A[%d].:",i);
- scanf("%d",&x[i]);
- }
- printf("Kerem az 'a' erteket:");
- scanf("%f",&a);
- printf("Kerem a 'b' erteket:");
- scanf("%f",&b);
- printf("Kerem az 'n' erteket:");
- scanf("%f",&n);
- y=sqrt(fabs(a-pow(b,2)-sin(3.1415*a)));
- if(y<2) {
- for (i=1;i<n+1;i++)
- {
- if (x[i]>0){
- s=s+x[i];
- }
- }
- printf("Az elso n pozitiv szam osszege:%.3f",s);
- }
- else {
- for (i=1;i<n+1;i++)
- {
- k=k+pow(x[i],2);
- }
- printf("Az elso n szam negyzeteinek osszege:%.3f",k);
- }
- printf("\n\nNyomjon < space >-t a kilepeshez ");
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement