React Components Explained: Types, Features and Examples for Beginners

Image
Learn Functional and Class Components in React with Practical Examples. 1. Introduction to React Components React is a popular JavaScript library used to build modern and interactive user interfaces. It helps developers create websites and web applications that are fast, flexible, and easy to maintain. One of the most important concepts in React is Components. React Components make it possible to divide a large user interface into smaller and reusable parts. For example, a website may contain a Header, Navigation Bar, Sidebar, Main Content, and Footer. Instead of writing all the code in a single file, developers can create separate components for each section. This approach makes website development more organized and understandable. Beginners can learn React more easily by understanding how components work. 2. What Are React Components? React Components are independent and reusable pieces of a user interface. They are one of the basic building blocks of React applications....

c program to check number is even or odd use if else

                          c program

c program to check number is even or odd

Examples :-


// even or odd program if else
//if else statement statement only allows
// program to execute one block of code if a check condition
// is true than execute the block or condition is false than exite the block
// of code.

#include<stdio.h>

int main()
{
int number= 0;

printf("enter a number");
scanf("%d",&number);
if(number %2 ==0 )
{
printf("%d is even");
}
else
{
printf("%d is odd");
}

return 0;
}


 c program to check number is even or odd use if else

Explain Program

Step :1

#include <stdio.h>

 input-output use printf() & scanf() function.

Step :2

int main()

 point of the C program. All execution .

Step :3

  • printf("enter a number");
  • Prints a prompt for the user. You could add a newline ("\n") for cleanliness.

Step :4

  • scanf("%d", &number);
  • Reads an integer from the user and stores it in number. The & gives the variable’s memory address.

Step :5

if (number % 2 == 0) {

    printf("%d is even");

} else {

    printf("%d is odd");

}

Step :6

  • If (number % 2) == 0, there's no remainder, so it's even.
  • Otherwise, it's odd.

Step :7

if (number & 1)   // true if odd (LSB is 1)

else              // even (LSB is 0)

Step :8

printf("%d is even\n", number);

Add a newline to output for readability

 c program to check number is even or odd use if else

Output 

enter a number  
7 is Odd


Related post :-

c program add two integer number

left pascal star pattern in php

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

CSS Outline Offset Property with Practical Examples