WIPRO CODING ANSWERS

 WIPRO CODING

ANSWERS


/>


/>


/>

#include<stdio.h>

int main()

{

    int a=0,b=1,c,i,n,sum=0;

    printf("enter number\n");

    scanf("%d",&n);

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

    {

        c=a+b;

        sum=sum+c;

        a=b,b=c;

    }


printf("%d",sum+1);

return 0;

}

@freejobs77

@freejobs77



E-commerce question ans

@freejobs77

@freejobs77

/>


/>


/>


/>

def check(a,n)

if n==1:

       return 1

     a.sort()

     c=0

     i=0

     while(i<n-1):

            if a[i+1]-a[i]==1:

                  i=i+2

                  c=c+1

           else:

                  i=i+1

      if c:

            return c

      else:

            return 1

n=int(input())

a=[]

for i in range(n):

      a.append(int(input()))

print(check(a,n))


Python

Join

@freejobs77

@freejobs77

@freejobs77

@freejobs77

@freejobs77

@freejobs77

@freejobs77

/>


/>


/>


/>


/>

Post a Comment

2 Comments

  1. A credit card company decided to introduce a new functionality for reward points on grocery items. A certain amount of reward points will be given to the user if they use a credit card for the payment. Reward points are calculated by the sum of all the odd digits of the bill amount for the user.

    Write an algorithm which will calculate the reward points for the user based on the bill amount.

    ReplyDelete