Sie sind auf Seite 1von 6

24/01/2015

AttemptSession

E
BOX

MohammedRafiqMeeranD

(/notification/showAll?
courseId=&uniqueId=)

Home(/course/coursetabs) / Courses(/course/show/808)
Aspartofmaintenance,Theserverwillbedownbetween2401201506:00PMand2701
201509:00AM.

GOTO SECTIONS (/AMPHISESSION/SHOWATTEMPTSTATUS)


INSTRUCTIONS

Problem

Program

Submissions

ProgrammingLanguage
C
GET EDITOR
PROBLEM (/PROBLEM/SHOWDESCRIPTION/2207)
SAVE COMPILE EXECUTE VALIDATE SUBMIT
(/CONTESTCOMPONENT/DOWNLOADPROGRAM?LANG=7)

ShowTemplateInsertTemplate

1
http://cognizant.ebox.co.in/amphiSession/processSession

1/6

24/01/2015

AttemptSession

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16

http://cognizant.ebox.co.in/amphiSession/processSession

2/6

24/01/2015

AttemptSession

17
18
19
20

21 #include<stdio.h>
Programterminated

>3
>122 intprod(int);
>3
>5
23
>1719 intmain()
>
24

25

Previousintn;
4/6123456 Next
26

scanf("%d",&n);

CognizantTechnologySolutions(http://www.cognizant.com)
27

prod(n);

28

return0;

29

30

intprod(intn)

31

http://cognizant.ebox.co.in/amphiSession/processSession

PoweredbyEBox

3/6

24/01/2015

AttemptSession

32

inta[20],i,m=0,d=0,sum=0,temp=1,temp1=1;

33

for(i=0;i<n;i++)

34

35

scanf("%d",&a[i]);

36

37

for(i=0;i<n;i++)

38

39

if(a[i]%2==0)

40

41

m=temp*a[i];

42

temp=m;

43

44

else

45

46

d=temp1*a[i];

47

temp1=d;

http://cognizant.ebox.co.in/amphiSession/processSession

4/6

24/01/2015

AttemptSession

47

temp1=d;

48

49

}
sum=m+d;
for(i=0;i<n;i++)
{
if(a[i]%2==0)
{
i++;
}
sum=sum+1;
if(a[i]%2!=0)
{
i++;

}
sum=sum+1;

http://cognizant.ebox.co.in/amphiSession/processSession

5/6

24/01/2015

AttemptSession

printf("%d",sum);
}
return0;

http://cognizant.ebox.co.in/amphiSession/processSession

6/6

Das könnte Ihnen auch gefallen