Skip to main content

Noise Pollution Control in Industries: Strategies and Solutions

Noise pollution is a significant environmental issue, particularly in industrial settings. The constant hum of machinery, the clanging of metal, and the roar of engines contribute to a cacophony that can have serious health implications for workers and nearby residents. Addressing noise pollution in industries is not only a matter of regulatory compliance but also a crucial step in ensuring the well-being of employees and the community. Understanding Noise Pollution in Industries Industrial noise pollution stems from various sources such as heavy machinery, generators, compressors, and transportation vehicles. Prolonged exposure to high levels of noise can lead to hearing loss, stress, sleep disturbances, and cardiovascular problems. Beyond health impacts, noise pollution can also reduce productivity, increase error rates, and contribute to workplace accidents. Regulatory Framework Many countries have established regulations and standards to limit industrial noise. Organizations like t

Iterative statement

Iterative Statements
Iterative statements are used to repeat the implementation of a series of statements until the specified expression becomes false. C supports three types of repetitive statements also known as looping 
statements. They are
* while loop
* do–while loop
* for loop
In this part, we will discuss all these statements.

while loop
The while loop supports a mechanism to repeat one or more statements while a specific condition is true. Figure below shows the syntax and general form of a while loop.
Note that in the while loop, the condition is verified before any of the statements in the statement block is implemented. If the condition is true, only then the statements will be implemented, otherwise if the condition is false, the control will jump to statement y, that is the next statement outside the while loop block.
In the flow diagram it is clear that we require to constantly update the condition of the while loop. It is this condition which defines when the loop will end. The while loop will implement as long as the condition is true. Note that if the condition is not at all updated and the condition not at all becomes false, then the computer will run into an infinite loop which is not at allSensible. For example, the following code prints the first 10 numbers using a while loop.
#include <stdio.h>
int main()
{
int i = 1;
while(i<=10)
{
 printf("\n %d", i);
 i = i + 1; // condition updated
}
return 0;
}
Note that initially i = 1 and is less than 10, i.e., the condition is true, so in the while loop the value of i is printed and its value is incremented by 1. When i=11, the condition becomes false and the loop ends.
Write a program to calculate the sum of numbers from m to n.
#include <stdio.h>
int main()
{
int n, m, i, sum =0;
printf("\n Enter the value of m : ");
scanf("%d", &m);
i=m;
printf("\n Enter the value of n : ");
scanf("%d", &n);
while(i<=n)
{
 sum = sum + i;
 i = i + 1;
}
printf("\n The sum of numbers from %d to %d = %d", m, n, sum);
return 0;
}
Output
Enter the value of m : 2
Enter the value of n : 10
The sum of numbers from 2 to 10 = 54

do–while Loop
The do–while loop is same as the while loop. The only difference is that in a do–while loop, at the end of the loop condition is tested. As the test condition is calculated at the end, this means that the body of the loop gets implemented at least one time (even if the condition is false). Below figure shows the syntax and the general form of a do–while loop.
Fig: do while construct
Note that the test condition is encompass in parentheses and followed by a semi-colon. The statements in the statement block are enclosed within curly brackets. The curly brackets are voluntery if there is only one statement in the body of the do–while loop.
The do–while loop continues to implement while the condition is true and when the condition becomes false, the control moves to the statement following the do–while loop.
The main disadvantage of using a do–while loop is that it always implements at least once, so even if the user gives some invalid data, the loop will implement. However, do–while loops are broadly used to print a list of options for menu-driven programs. For example, consider the following code.
#include <stdio.h>
int main()
{
int i = 1;
do
{
 printf("\n %d", i);
 i = i + 1;
} while(i<=10);
return 0;
}
What do you think will be the output? Yes, the code will print numbers from 1 to 10.
Write a program to calculate the average of first n numbers.
#include <stdio.h>
int main()
{
int n, i = 0, sum =0;
float avg = 0.0;
printf("\n Enter the value of n : ");
scanf("%d", &n);
do
{
 sum = sum + i;
 i = i + 1;
} while(i<=n);
avg = (float)sum/n;
printf("\n The sum of first %d numbers = %d",n, sum);
printf("\n The average of first %d numbers = %.2f", n, avg);
return 0;
}
Output
Enter the value of n : 20
The sum of first 20 numbers = 210
The average of first 20 numbers = 10.05

for Loop
Like the while and do–while loops, the for loop gives a method to repeat a task till a specific condition is true. The synax and general form of a for loop is given in Fig. below.
Fig: for loop construct
When a for loop is used, the loop variable is initialized only once. With every repetitive, the value of the loop variable is updated and the condition is verified. If the condition is true, the statement block of the loop is implemented, else the statements comprising the statement block of the for loop are skipped and the control moves to the statement following the for loop body.
In the syntax of the for loop, initialization of the loop variable permits the programmer to give it a value. Second, the condition defines that while the conditional expression is true, the loop
should continue to repeat itself. Every repetition of the loop must make the condition to exit the loop approachable. So, with every iteration, the loop variable must be updated. Updating the loop 
variable may include incrementing the loop variable, decrementing the loop variable or setting it to some other value like, i +=2, where i is the loop variable.
Note that every section of the for loop is divided from the other with a semi-colon. It is possible that one of the divisions may be empty, though the semi-colons still have to be there. However, 
if the condition is empty, it is calculated as true and the loop will repeat until something else stops it.
The for loop is mostly used to implement a single or a group of statements for a limited number of times. The following code shows how to print the first n numbers using a for loop.
#include <stdio.h>
int main()
{
int i, n;
printf("\n Enter the value of n :");
scanf("%d", &n);
for(i=1;i<=n;i++)
 printf("\n %d", i);
return 0;
}
In the code, i is the loop variable. Initially, it is initialized with 1. Suppose the user enters 10 as the value of n. Then the condition is checked, since the condition is true as i is less than n, the statement in the for loop is executed and the value of i is printed. After every iteration, the value 
of i is incremented. When i exceeds the value of n, the control jumps to the return 0 statement.
Programming Example
Write a program to determine whether a given number is a prime or a composite number.
#include <stdio.h>
#include <conio.h>
int main()
{
int flag = 0, i, num;
clrscr();
printf("\n Enter any number : ");
scanf("%d", &num);
for(i=2; i<num/2;i++)
{
if(num%i == 0)
 {
flag =1;
 break;
 }
}
if(flag == 1)
printf("\n %d is a composite number", num);
else
printf("\n %d is a prime number", num);
return 0;
}
Output
Enter any number : 37
37 is a prime number

Popular posts from this blog

FIRM

          A firm is an organisation which converts inputs into outputs and it sells. Input includes the factors of production (FOP). Such as land, labour, capital and organisation. The output of the firm consists of goods and services they produce.           The firm's are also classified into categories like private sector firms, public sector firms, joint sector firms and not for profit firms. Group of firms include Universities, public libraries, hospitals, museums, churches, voluntary organisations, labour unions, professional societies etc. Firm's Objectives:            The objectives of the firm includes the following 1. Profit Maximization:           The traditional theory of firms objective is to maximize the amount of shortrun profits. The public and business community define profit as an accounting concept, it is the difference between total receipts and total profit. 2. Firm's value Maximization:           Firm's are expected to operate for a long period, the

Introduction to C Programs

INTRODUCTION The programming language ‘C’ was developed by Dennis Ritchie in the early 1970s at Bell Laboratories. Although C was first developed for writing system software, today it has become such a famous language that a various of software programs are written using this language. The main advantage of using C for programming is that it can be easily used on different types of computers. Many other programming languages such as C++ and Java are also based on C which means that you will be able to learn them easily in the future. Today, C is mostly used with the UNIX operating system. Structure of a C program A C program contains one or more functions, where a function is defined as a group of statements that perform a well-defined task.The program defines the structure of a C program. The statements in a function are written in a logical series to perform a particular task. The most important function is the main() function and is a part of every C program. Rather, the execution o

Human Factors in Designing User-Centric Engineering Solutions

Human factors play a pivotal role in the design and development of user-centric engineering solutions. The integration of human-centered design principles ensures that technology not only meets functional requirements but also aligns seamlessly with users' needs, abilities, and preferences. This approach recognizes the diversity among users and aims to create products and systems that are intuitive, efficient, and enjoyable to use. In this exploration, we will delve into the key aspects of human factors in designing user-centric engineering solutions, examining the importance of user research, usability, accessibility, and the overall user experience. User Research: Unveiling User Needs and Behaviors At the core of human-centered design lies comprehensive user research. Understanding the target audience is fundamental to creating solutions that resonate with users. This involves studying user needs, behaviors, and preferences through various methodologies such as surveys, interview