Saturday, July 18, 2020

Birthday Cake Candles HackerRank Solution in C programming.


Birthday Cake Candles HackerRank Solution in C programming.

To see full question, please visit Hackerrank.
























#include<stdio.h>
int main()
{
int n,c=0;

long int a[100000],i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%ld",&a[i]);
}
int max=a[0];
for(i=0;i<n;i++)
{
if(max<a[i])
{
max=a[i];
}
}
for(i=0;i<n;i++)
{
if(a[i]==max)
{
c++;
}
}
printf("%d",c);
return 0;
}

Hacker Rank Apple & Orange Problem's Solution using C programming.

Hacker Rank Apple & Orange Problem's Solution using C programming.

You can see full questions from this given link
https://www.hackerrank.com/challenges/apple-and-orange/problem

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
    int s;
    int t,count1=0,count2=0;
    scanf("%d %d",&s,&t);
    int a;
    int b;
    scanf("%d %d",&a,&b);
    int m;
    int n;
    scanf("%d %d",&m,&n);
    int temp;
    for(int apple_i = 0; apple_i < m; apple_i++){
       scanf("%d",&temp);
        if(temp+a>=s && temp+a<=t)
            {
            count1++;
        }
    }
    for(int orange_i = 0; orange_i < n; orange_i++){
        scanf("%d",&temp);
        if(temp+b>=s && temp+b<=t)
            {
            count2++;
        }
    }
    printf("%d\n",count1);
    printf("%d",count2);
    return 0;
}

Birthday Cake Candles HackerRank Solution in C programming.

Birthday Cake Candles HackerRank Solution in C programming. To see full question, please visit Hackerrank. ...