Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #define MAX 100
- int main()
- {
- int n,a[MAX];
- scanf("%d",&n);
- int i;
- for(i=0;i<n;i++)
- scanf("%d",&a[i]);
- int pom=0,ilok=0,dlok=0,prpom=1;
- int j;
- int proizvod;
- int br=1;
- for(i=0;i<n;i++)
- {
- proizvod=1; br=1;
- for(j=i;j<n;j++)
- {
- if(a[j]<a[j+1])
- {
- br++;
- proizvod=proizvod*a[j];
- }
- else
- {
- if(br>pom)
- {
- proizvod=proizvod*a[j];
- pom=br;
- ilok=j;
- dlok=i;
- prpom=proizvod;
- }
- break;
- }
- }
- }
- printf("pochnuva od %d trae do %d i geo.sred. e %f",a[dlok],a[ilok],pow(prpom,1.0/(float)pom));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement