Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

19bec0685 VL2019205002844 Da

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Q.6) Using two dimensional arrays write a C program for the following problem.

Take the input of


concentration of any 10 hardness producing substances from the user and print the calcium
carbonate equivalent of the requested substance

#include <stdio.h>

#include <stdlib.h>

#include <conio.h>

int main ()

float array [3] [10];

int x, y;

for (x = 0; x<10; x++) //to input data

printf(“ENTER DATA FOR COMMAND %d \y” x+1);

printf (“Enter Composition (mg/L): \n”);

scanf(“%f”, &array[0] [x]);

printf(“Enter Molar Mass (g): \n”);

scanf (“%f”, &array[1] [x]);

array[2] [x] = array [0] [j]*(100.0/array[1] [j]); //CaCO3 Eqv

Printf(“nEnter compound number to find CaC03 EQV \n”);

Scanf (“%d”, &y);

For (x =0; x<10; x++)

If (y == x+1)

{
Printf(“CaCO3 EQV FOR COMPOUND %D IS %F MG/L \Y”, Y,array[2] [x]);

Return 0;

Q.1)

. Define a class to represent the details of hardness producing substances with the following data
members and member functions. Data members: i. Compound name ii. Molar mass iii. Multiplication
Factor Member functions: i. To take the input of the details of the compound ii. To print the details
of the compound Create an object to take the input of any five permanent hardness producing
substances from user and print the same in the output screen.

The following is screenshot for question 1 from c++

You might also like