Skip to main content

Cloud computing in engineering workflows

Cloud Computing in Engineering Workflows:   Transforming Design, Collaboration, and Innovation In today’s fast-paced engineering landscape, the need for speed, scalability, and seamless collaboration is greater than ever. Traditional engineering workflows often relied on on-premises servers, powerful local machines, and fragmented communication tools. But as projects grow in complexity and teams become more global, these systems can no longer keep up. This is where cloud computing steps in—reshaping how engineers design, simulate, collaborate, and deliver results. What is Cloud Computing in Engineering? Cloud computing refers to the use of remote servers hosted on the internet to store, process, and analyze data. Instead of being limited by the hardware capacity of a single computer or office server, engineers can leverage vast, scalable computing resources from cloud providers. This shift enables engineers to run simulations, share designs, and manage data more efficiently. Key Be...

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

Abbreviations

No :1 Q. ECOSOC (UN) Ans. Economic and Social Commission No: 2 Q. ECM Ans. European Comman Market No : 3 Q. ECLA (UN) Ans. Economic Commission for Latin America No: 4 Q. ECE (UN) Ans. Economic Commission of Europe No: 5 Q. ECAFE (UN)  Ans. Economic Commission for Asia and the Far East No: 6 Q. CITU Ans. Centre of Indian Trade Union No: 7 Q. CIA Ans. Central Intelligence Agency No: 8 Q. CENTO Ans. Central Treaty Organization No: 9 Q. CBI Ans. Central Bureau of Investigation No: 10 Q. ASEAN Ans. Association of South - East Asian Nations No: 11 Q. AITUC Ans. All India Trade Union Congress No: 12 Q. AICC Ans. All India Congress Committee No: 13 Q. ADB Ans. Asian Development Bank No: 14 Q. EDC Ans. European Defence Community No: 15 Q. EEC Ans. European Economic Community No: 16 Q. FAO Ans. Food and Agriculture Organization No: 17 Q. FBI Ans. Federal Bureau of Investigation No: 18 Q. GATT Ans. General Agreement on Tariff and Trade No: 19 Q. GNLF Ans. Gorkha National Liberation Front No: ...

Operations on data structures

OPERATIONS ON DATA STRUCTURES This section discusses the different operations that can be execute on the different data structures before mentioned. Traversing It means to process each data item exactly once so that it can be processed. For example, to print the names of all the employees in a office. Searching It is used to detect the location of one or more data items that satisfy the given constraint. Such a data item may or may not be present in the given group of data items. For example, to find the names of all the students who secured 100 marks in mathematics. Inserting It is used to add new data items to the given list of data items. For example, to add the details of a new student who has lately joined the course. Deleting It means to delete a particular data item from the given collection of data items. For example, to delete the name of a employee who has left the office. Sorting Data items can be ordered in some order like ascending order or descending order depending ...

The Rise of Solar and Wind Energy: A Glimpse into a Sustainable Future

In the quest for a sustainable future, solar and wind energy systems have emerged as two of the most promising sources of renewable energy. As concerns about climate change and the depletion of fossil fuels grow, these technologies offer a pathway to a cleaner, more resilient energy grid. This blog post delves into the significance of solar and wind energy, their benefits, challenges, and the role they play in shaping a sustainable future. The Basics of Solar and Wind Energy Solar Energy Systems harness the power of the sun to generate electricity. The most common technology used is photovoltaic (PV) panels, which convert sunlight directly into electricity. Solar thermal systems, another approach, use mirrors or lenses to concentrate sunlight, generating heat that can be used to produce electricity. Solar energy is abundant, renewable, and available almost everywhere on Earth. Wind Energy Systems utilize wind turbines to convert the kinetic energy of wind into electrical energy. Thes...