Posts

Showing posts from March 8, 2021

Left Number Twice Right

 Left Number Twice Right  PROBLEM STATEMENT : A set of N numbers (separated by one or more spaces) is passed as input to the program. The program must identify the count of numbers C where the number on the left is twice the number on the right.  Boundary Conditions:   3 <= N <= 50  The value of the numbers can be from -99999999 to 99999999  Input Format: The first line will contain the N numbers separated by one or more spaces.  Output Format: The first line contains the value of C.  Example Input/Output 1:   Input: 10 20 5 40 15 -2 -30 -1 60  Output: 2 Explanation: The numbers meeting the criteria are 20, -30  Example Input/Output 2:  Input: 5 90 10 2 5 -4 10 6 5 3  Output: 3 Explanation: The numbers meeting the criteria are 2, 6, 5 SOLUTION : C (Programming Language) Copy Code #include<stdio.h> #include<stdlib.h> int main() { int a[50],n=-1,i,cnt=0; while(scanf("%d",&a[++n...