Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

TCS Coding Q-01

TCS NQT

Q. An automobile company manufactures both a two wheeler (TW) and a four wheeler (FW). A company manager wants to make the production of both types of vehicle according to the given data below:
1st data, Total number of vehicle (two-wheeler + four-wheeler)=v
2nd data, Total number of wheels = W
The task is to find how many two-wheelers as well as four-wheelers need to manufacture as per the given data.
C Program:
#include <stdio.h>


int main () 
{
  int v, w;
  v=100;
  w=300;
  int tw = ((4 * v)  w) / 2;
  if ((& 1) || w < 2 || w <= v)
    {
      printf( “Invalide Input”);
      return 0;
    }
printf(“TW = %d “,tw);
printf(“n”);
printf(“FW = %d”,vtw);


}
Output:
TW = 50 
FW = 50

C++ Program:
#include <iostream>
using namespace std;

int main () 
{
  int v, w;
  v=100;
  w=300;
  //cin >> v >> w;
  float tw = ((4 * v)  w) / 2;
  if ((& 1) || w < 2 || w <= v)
    {
      cout << “Invalide Input”;
      return 0;
    }
cout << “TW=” << tw << ” “ << “FW=” << v  tw;

}
Output:
TW=50 FW=50