NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Kimberly G. Necesario BSIT EVE 1-2B

1.1 Relational Operators in C Programming:

Relational operators are used to compare values or expressions in C programming. They return a Boolean value, which is either true (1) or false (0) based on whether the comparison is true or false.
Common relational operators in C are:

'==' (Equal to): Checks if two values are equal.
'!=' (Not equal to): Checks if two values are not equal.
'<' (Less than): Checks if the left operand is less than the right operand.
'>' (Greater than): Checks if the left operand is greater than the right operand.
'<'= (Less than or equal to): Checks if the left operand is less than or equal to the right operand.
'>=' (Greater than or equal to): Checks if the left operand is greater than or equal to the right operand.

For example:
#include <stdio.h>

int main() {
int a = 5, b = 10;

if (a == b) {
printf("a is equal to bn");
} else {
printf("a is not equal to bn");
}

if (a < b) {
printf("a is less than bn");
} else {
printf("a is not less than bn");
}

return 0;
}

1.2. Logical Operators:

Logical operators are used to perform logical operations on Boolean values (true or false).
Common logical operators:

&& (logical AND): Returns true if both operands are true.
|| (logical OR): Returns true if at least one operand is true.
! (logical NOT): Returns the opposite of the operand's value.

nt x = 5;
int y = 10;
if (x > 0 && y < 15) {
printf("Both conditions are truen");
}

int isRainy = 1; // Assuming 1 means true (it's rainy)
if (!isRainy) {
printf("It's not rainy todayn");
}
You apply relational operators to compare values in conditions (like in if statements) to make decisions based on the comparison results. Logical operators are used to combine and manipulate Boolean values in more complex conditions.

2. Decision control statements in C programming are used to control the flow of a program based on certain conditions. These statements allow you to make decisions in your code, executing different blocks of code depending on whether specific conditions are met.

2.1. Meaning:
Decision control statements enable a program to perform different actions or execute different code blocks based on the evaluation of conditions. These conditions can be comparisons, Boolean expressions, or other logical tests.
2.2. Flowchart with explanation:
Start
|
V
Condition (e.g., x > y)
|
V
------------
| True Path |
------------
|
V
Action if Condition is True
|
V
-------------
| False Path |
-------------
|
V
Action if Condition is False
|
V
End
Explanation:
The program starts at the "Start" point.
It evaluates a condition (e.g., x > y) to determine whether it's true or false.
If the condition is true, it takes the "True Path" and executes a specific action or block of code.
If the condition is false, it takes the "False Path" and executes a different action or block of code.
Finally, the program reaches the "End."
2.3
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.