Wipro Elite Coding Problem #1 | New Year Discount

Today we are going to discuss some Wipro Elite Coding Questions that has been asked in previous years in Wipro for Project Engineer role for Freshers.

So, If you are appearing in Wipro Elite, then there are fair chances that you can get same difficulty level of questions in your actual exam.

Wipro Elite coding problem 1

Hi all, Welcome to Jobs Adda. Here you would get all fresher jobs updates and placement material for engineering graduates related to IT/Core sector.

To get all job updates on time, Don’t forget to join our whatsapp group. Click below to join.


An e-commerce company plans to give their customers a discount for the New Years holiday. The discount will be calculated on the basis of the bill amount of the order placed. The discount amount is the sum of all the odd digits on the customer’s total bill amount. If no odd digit is present in the bill amount, then the discount will be zero. Write an algorithm to find a discount for the given total bill amount.


Input:
The input consists of an integer bill amount, representing the customer’s total bill amount.


Output:
Print an integer representing the discount for the given total bill amount.


Constraints:
0 <billAmount ≤ 109


Example
Input:
2514795
Output:
27


Explanation:
Odd digits in the given number 2514795 are 5, 1, 7, 9, 5. The sum of these odd digits is 27. So, the output is 27.

Solution: In C

#include <stdio.h>
int main()
{
    long int n;
    scanf("%ld", &n);
    int dis=0;
    while(n)
    {
        if((n%10)%2 !=0)
            dis=dis+n%10;
        n=n/10;
    }
    printf("%d",dis);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Jobs Addaa

Subscribe now to keep reading and get access to the full archive.

Continue reading