The document discusses C programming concepts including control statements, loops, relational operators, data types, arrays, and functions. It provides code examples to demonstrate while, for, do-while loops, if/else statements, functions, arrays, and more. Various outputs are shown for the example code snippets.
C lecture 3 control statements slideshareGagan Deep
Control Statement in C, Looping in C, Conditional and Unconditional Statements, For Loop, While Loop, Do-While Loop, C Programming, Examples : Visit us at www.rozyph.com
C lecture 3 control statements slideshareGagan Deep
Control Statement in C, Looping in C, Conditional and Unconditional Statements, For Loop, While Loop, Do-While Loop, C Programming, Examples : Visit us at www.rozyph.com
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
This page contains examples and source code on decision making in C programming (to choose a particular statement among many statements) and loops ( to perform repeated task ). To understand all the examples on this page, you should have knowledge of following topics:
if...else Statement
for Loop
while Loop
break and Continue Statement
switch...case
Detailing about basics of C language and its control structure for learning C Language for beginners. It covers looping statement , control statement etc.
what are loop in general
what is loop in c language
uses of loop in c language
types of loop in c language
program of loop in c language
syantax of loop in c language
At the end of this lecture students should be able to;
Describe the looping structures in C programming language.
Practice the control flow of different looping structures in C programming language.
Practice the variants in control flow of different looping structures in C programming language.
Apply taught concepts for writing programs.
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
This page contains examples and source code on decision making in C programming (to choose a particular statement among many statements) and loops ( to perform repeated task ). To understand all the examples on this page, you should have knowledge of following topics:
if...else Statement
for Loop
while Loop
break and Continue Statement
switch...case
Detailing about basics of C language and its control structure for learning C Language for beginners. It covers looping statement , control statement etc.
what are loop in general
what is loop in c language
uses of loop in c language
types of loop in c language
program of loop in c language
syantax of loop in c language
At the end of this lecture students should be able to;
Describe the looping structures in C programming language.
Practice the control flow of different looping structures in C programming language.
Practice the variants in control flow of different looping structures in C programming language.
Apply taught concepts for writing programs.
TO UNDERSTAND about stdio.h in C.
TO LEARN ABOUT Math.h in C.
To learn about ctype.h in C.
To understand stdlib.h in c.
To learn about conio.h in c.
To learn about String.h in c.
TO LEARN ABOUT process.h in C.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Modern design is crucial in today's digital environment, and this is especially true for SharePoint intranets. The design of these digital hubs is critical to user engagement and productivity enhancement. They are the cornerstone of internal collaboration and interaction within enterprises.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
3. #include <stdio.h>
int main(void)
{
long num;
long sum = 0L; /* initialize sum to zero */
int status;
printf("Please enter an integer to be summed ");
printf("(q to quit): ");
status = scanf("%ld", &num);
while (status == 1) /* == means "is equal to" */
{
sum = sum + num;
printf("Please enter next integer (q to quit): ");
status = scanf("%ld", &num);
}
printf("Those integers sum to %ld.n", sum);
return 0;
}
4. Output
Please enter an integer to be summed (q to quit): 44
Please enter next integer (q to quit): 33
Please enter next integer (q to quit): 88
Please enter next integer (q to quit): 121
Please enter next integer (q to quit): q
Those integers sum to 286.
5. Relational Operators
Operator Meaning
< Is less than
<= Is less than or equal to
== Is equal to
>= Is greater than or equal to
> Is greater than
!= Is not equal to
6. #include <math.h>
#include <stdio.h>
int main(void)
{
const double ANSWER = 3.14159;
double response;
printf("What is the value of pi?n");
scanf("%lf", &response);
while (fabs(response - ANSWER) > 0.0001)
{
printf("Try again!n");
scanf("%lf", &response);
}
printf("Close enough!n");
return 0;
}
8. /* t_and_f.c -- true and false values in C */
#include <stdio.h>
int main(void)
{
int true_val, false_val;
true_val = (10 > 2); /* value of a true relationship */
false_val = (10 == 2); /* value of a false relationship */
printf("true = %d; false = %d n", true_val, false_val);
return 0;
}
10. #include <stdio.h>
int main(void)
{
int n = 3;
while (n)
{
printf("%2d is truen", n--);
}
printf("%2d is falsen", n);
n = -3;
while (n)
{
printf("%2d is truen", n++);
}
printf("%2d is falsen", n);
return 0;
}
11. Output
3 is true
2 is true
1 is true
0 is false
-3 is true
-2 is true
-1 is true
0 is false
12. #include <stdio.h>
int main(void)
{
long num;
long sum = 0L;
int status;
printf("Please enter an integer to be summed ");
printf("(q to quit): ");
status = scanf("%ld", &num);
while (status = 1)
{
sum = sum + num;
printf("Please enter next integer (q to quit): ");
status = scanf("%ld", &num);
}
printf("Those integers sum to %ld.n", sum);
return 0;
}
13. Output
Please enter an integer to be summed (q to quit): 20
Please enter next integer (q to quit): 5
Please enter next integer (q to quit): 30
Please enter next integer (q to quit): q
Please enter next integer (q to quit):
Please enter next integer (q to quit):
Please enter next integer (q to quit):
Please enter next integer (q to quit):
14. The New _Bool Type
Variables intended to represent true/false values traditionally have been
represented by type int in C. C99 adds the _Bool type specifically for variables of
this sort. The type is named after George Boole, the English mathematician who
developed a system of algebra to represent and solve problems in logic. In
programming, variables representing true or false have come to be known as
Boolean variables, so _Bool is the C type name for a Boolean variable. A _Bool
variable can only have a value of 1 (true) or 0 (false). If you try to assign a
nonzero numeric value to a _Bool variable, the variable is set to 1, reflecting that
C considers any nonzero value to be true.
15. #include <stdio.h>
int main(void)
{
long num;
long sum = 0L;
_Bool input_is_good;
printf("Please enter an integer to be summed ");
printf("(q to quit): ");
input_is_good = (scanf("%ld", &num) == 1);
while (input_is_good)
{
sum = sum + num;
printf("Please enter next integer (q to quit): ");
input_is_good = (scanf("%ld", &num) == 1);
}
printf("Those integers sum to %ld.n", sum);
return 0;
}
16. Precedence of Relational Operators
The precedence of the relational operators is less than that of the arithmetic
operators, including + and -, and greater than that of assignment operators.
22. More Assignment Operators: +=, -=, *=, /=,
%=
• scores += 20 is the same as scores = scores + 20.
• dimes -= 2 is the same as dimes = dimes - 2.
• bunnies *= 2 is the same as bunnies = bunnies * 2.
• time /= 2.73 is the same as time = time / 2.73.
• reduce %= 3 is the same as reduce = reduce % 3.
23. The Comma Operator
The comma operator extends the flexibility of the for loop by enabling you to include
more than one initialization or update expression in a single for loop specification.
24. #include <stdio.h>
int main(void)
{
const int FIRST_OZ = 37;
const int NEXT_OZ = 23;
int ounces, cost;
printf(" ounces costn");
for (ounces=1, cost=FIRST_OZ; ounces <= 16; ounces++,
cost += NEXT_OZ)
{
printf("%5d $%4.2fn", ounces, cost/100.0);
}
return 0;
}
26. #include <stdio.h>
int main(void)
{
int t_ct; // term count
double time, x;
int limit;
printf("Enter the number of terms you want: ");
scanf("%d", &limit);
for (time=0, x=1, t_ct=1; t_ct <= limit; t_ct++, x *= 2.0)
{
time += 1.0/x;
printf("time = %f when terms = %d.n", time, t_ct);
}
return 0;
}
27. Output
Enter the number of terms you want: 15
time = 1.000000 when terms = 1.
time = 1.500000 when terms = 2.
time = 1.750000 when terms = 3.
time = 1.875000 when terms = 4.
time = 1.937500 when terms = 5.
time = 1.968750 when terms = 6.
time = 1.984375 when terms = 7.
time = 1.992188 when terms = 8.
time = 1.996094 when terms = 9.
time = 1.998047 when terms = 10.
time = 1.999023 when terms = 11.
time = 1.999512 when terms = 12.
time = 1.999756 when terms = 13.
time = 1.999878 when terms = 14.
time = 1.999939 when terms = 15.
28. An Exit-Condition Loop: do while
The while loop and the for loop are both entry-condition loops. The
test condition is checked before each iteration of the loop, so it is
possible for the statements in the loop to never execute. C also has an
exit-condition loop, in which the condition is checked after each
iteration of the loop, guaranteeing that statements are executed at
least once. This variety is called a do while loop.
29. #include <stdio.h>
int main(void)
{
const int secret_code = 13;
int code_entered;
do
{
printf("To enter the triskaidekaphobia therapy club,n");
printf("please enter the secret code number: ");
scanf("%d", &code_entered);
} while (code_entered != secret_code);
printf("Congratulations! You are cured!n");
return 0;
}
30. Output
To enter the triskaidekaphobia therapy club,
please enter the secret code number: 12
To enter the triskaidekaphobia therapy club,
please enter the secret code number: 14
To enter the triskaidekaphobia therapy club,
please enter the secret code number: 13
Congratulations! You are cured!
31. Which Loop?
When you decide you need a loop, which one should you use? First, decide
whether you need an entry-condition loop or an exit-condition loop. Your
answer should usually be an entry-condition loop. There are several
reasons computer scientists consider an entry-condition loop to be superior.
One is the general principle that it is better to look before you leap (or loop)
than after. A second is that a program is easier to read if the loop test is
found at the beginning of the loop. Finally, in many uses, it is important
that the loop be skipped entirely if the test is not initially met.
32. Nested Loops
A nested loop is one loop inside another loop. A common use
for nested loops is to display data in rows and columns. One
loop can handle, say, all the columns in a row, and the second
loop handles the rows
33. #include <stdio.h>
#define ROWS 6
#define CHARS 10
int main(void)
{
int row;
char ch;
for (row = 0; row < ROWS; row++) /* line 10 */
{
for (ch = 'A'; ch < ('A' + CHARS); ch++) /* line 12 */
{
printf("%c", ch);
}
printf("n");
}
return 0;
}
37. Introducing Arrays
An array is a series of values of the same type, such as 10 chars or 15 ints, stored
sequentially. The whole array bears a single name, and the individual items, or
elements, are accessed by using an integer index.
Example:
float debts[20]; -- debts[5] = 32.54; -- debts[6] = 1.2e+21;
Using scanf() with arrays:
scanf("%f", &debts[4]); // read a value into the 5th element
38. #include <stdio.h>
#define SIZE 10
#define PAR 72
int main(void)
{
int index, score[SIZE];
int sum = 0;
float average;
printf("Enter %d golf scores:n", SIZE);
for (index = 0; index < SIZE; index++)
scanf("%d", &score[index]); // read in the ten scores
printf("The scores read in are as follows:n");
for (index = 0; index < SIZE; index++)
printf("%5d", score[index]); // verify input
printf("n");
for (index = 0; index < SIZE; index++)
{
sum += score[index]; // add them up
}
39. average = (float) sum / SIZE; // time-honored method
printf("Sum of scores = %d, average = %.2fn", sum, average);
printf("That's a handicap of %.0f.n", average - PAR);
return 0;
}
40. Output
Enter 10 scores:
Enter 10 golf scores:
102 98 112 108 105 103
99 101 96 102 100
The scores read in are as follows:
102 98 112 108 105 103 99 101 96 102
Sum of scores = 1026, average = 102.60
That's a handicap of 31.
41. #include <stdio.h>
double power(double n, int p); // ANSI prototype
int main(void)
{
double x, xpow;
int exp;
printf("Enter a number and the positive integer power");
printf(" to whichnthe number will be raised. Enter q");
printf(" to quit.n");
while (scanf("%lf%d", &x, &exp) == 2)
{
xpow = power(x,exp); // function call
printf("%.3g to the power %d is %.5gn", x, exp, xpow);
printf("Enter next pair of numbers or q to quit.n");
}
printf("Hope you enjoyed this power trip -- bye!n");
return 0;
}
42. double power(double n, int p) // function definition
{
double pow = 1;
int i;
for (i = 1; i <= p; i++)
pow *= n;
return pow; // return the value of pow
}
43. Output
Enter a number and the positive integer power to which
the number will be raised. Enter q to quit.
1.2 12
1.2 to the power 12 is 8.9161
Enter next pair of numbers or q to quit.
2
16
2 to the power 16 is 65536
Enter next pair of numbers or q to quit.
q
Hope you enjoyed this power trip -- bye!