4/29/21

Introduction to CSS :- CSS Tutorials

Hey Friends, from here we are going to start our new tutorial series about CSS. In this tutorial, we are going to cover complete CSS versions of CSS1, CSS2, CSS3 and gives you a complete understanding of CSS from the basics to advance. So let’s begin...

Introduction to CSS

CSS Stands for Cascading Style Sheet. It is used to style the web pages of the websites. It handles the look of Html documents. By applying CSS in your Html documents you can change the font of your web pages, color, alignment, style, background color, etc. a lot of things can be changed or style. CSS is easy to learn and understand. CSS is combined with other markup languages such as Html, XHTML, etc. to make web pages more attractive and beautiful. 

Why we should learn CSS?

CSS played an important role in web development. It is necessary to implement CSS Code in your Html file. It increases the standard of your website. Users easily interact with your site. You can’t build a website without CSS. CSS makes the website more attractive and more beautiful. So if you have to become a web developer then you should have to learn CSS:- 

Basic of web development: - Two basic skills that every web developer should have 1. Html 2. CSS. If you find a career in web development then you should have some knowledge about those two things.

Creating a stunning website: - Without CSS no one can create an attractive website. If you want to create a stunning website you need to apply CSS to it. 

Increase the user attraction: - A simple and attractive UI website would help the users to visit your website again and again. 

Example of a html webpage with or without CSS 

Without CSS

<html>

<head>

<title> Example of CSS </title>

<body>

<h1> This is a Heading </h1>

<p> This is an Example of html documents.

</body>

</html>

Output :- 


With CSS

<html>

<head>

<title> Example of CSS </title>

<style> 

h1{        background-color: yellow;

              color: red; }

p{         background-color: tomato;

             color: green; }

</style>

<body>

<h1> This is a Heading </h1>

<p> This is an Example of html documents.

</body>

</html>

Output:- 


Continue Reading →

4/25/21

C Program to Find Area and Perimeter of Rectangle

C Program to Find Area and Perimeter of a Given Length and Breadth

#include<stdio.h>

void main ()

{

float l,b,area,peri;

printf("Enter length breadth of rectangle=");

scanf("%f%f",&l,&b);

area=l*b;

peri=2*(l+b);

printf("Area is=%f",area);

printf("\nperimenter is=%f",peri);

if (area<=peri)

        printf("\nPerimeter is greater than area");

else

printf("\nArea is greater than perimeter");

getch();

}

Output:-

Explanation:- 

 In this program first, we have accepted input from the user (length and breadth). After that we put the formula of area and perimeter of rectangle into it. After that program gives the area and perimeter of rectangle as output. Then we compare the area and perimeter to check the which one of these are greatest. 

Continue Reading →

4/22/21

C Program to Find Square Root of any Number

 Program to Find Square Root of any Number.

#include<stdio.h>

#include<math.h>

void main()

{

int number;

float result;

printf("Enter the Number=");

scanf("%d",&number);

result=sqrt(number);

printf("Square root=%f",result);

getch();

}

Note:- In this program, we added a new header file named math.h. This header file is used to perform mathematical operations in our program. such as sqrt() to find square root, log() to find the logarithm of a number, etc.

Output:-


Continue Reading →

4/16/21

C Program to Find Simple Interest in C Programming.

Program to find Simple Interest 

#include<stdio.h>

#include<conio.h>

void main()

{

float p,r,t,si;

printf("Enter the value of Principle=");

scanf("%f",&p);

printf("Enter the value of Rate=");

scanf("%f",&r);

printf("Enter the value of Time (Year) =");

scanf("%f",&t);

si=p*r*t/100;

printf("Answer is=%f",si);

getch();

}

Output:- 



Continue Reading →

C Program to Find the greatest number between 3 Numbers.


C Program to Find Greatest Number Between 3 Numbers. 

#include <stdio.h>
#include <conio.h>
void main()
{
    int a,b,c;
    printf("Enter the three Number=");
    scanf("%d%d%d",&a,&b,&c);
    if (a>b)
    {
        if (a>c)
        {
            printf("A is greater number");
        }
        else
        {
            printf("C is greater number");
        }
    }
    else

        if(b>c)
        {
            printf("B is greater number");
        }
        else if (a==b && a==c)
        {
            printf("Numbers are equal");
        }
        else
        {
            printf("C is greater number");
        }
    getch();
}

Output :- 





Continue Reading →

4/15/21

C Program to find Odd & Even Number given by the User.


C Program to Find ODD & EVEN Number given by the user. 

#include<stdio.h>

void main()

{

    int a;

        printf("Enter the Number");

        scanf("%d",&a);

    if (a%2==0)

        printf("Number is Even");

    else

        printf("Number is Odd");

getch();

}

Output :-




Continue Reading →

4/11/21

Nested IF-Else in C Programming


Hey Friend, in our last tutorial we have seen about if statements, and if-else statements. In the if statement only one condition is check and if the condition is true then the output will be shown on the display. And on the other hand, we have also seen that if you have two conditions then if-else were used to check those conditions. 

Now, during the high-level programming, you have to check more than two conditions. For Example, you have to write a program to check whether

  • Num1 is less than num2
  • Num1 is greater than num2
  • Num1 is equal to num2

In that case, you have to use a nested if-else statement on your programs. 

Nested IF – ELSE

A nested if-else statement is used when a series of decisions were used to check through your program. As the name suggests, Nesting means using an if-else construct within another one. But guys basically there is no limitation to nesting. But the programmers nest up to 3 blocks only. You could use more if you want. 

Syntax of the nested if-else statement

if (condition)

   {

      Statement 1

      Statement 2 and so on

   }

else

   {

      if (condition)

   {

      Statement a

      Statement b

   }

else

   {

Statement c

Statement d

   }

}

I know it is a bit complex for beginners but I will explain it to you in the easiest way. So let’s try to understand this. 

Look at the syntax. you see that I am nested the if-else statement into the else statement of the syntax. Now when the code is executed then the compiler first checks the if condition (primary if block) if the condition is false of if statement then the compiler goes on the else part. Now in the else block it will check the if condition (secondary if block). If the condition is not true of secondary if block, then the compiler is print the else (secondary else part) as output.

You can also nested if-else on the if(primary statement). If you haven’t understood it yet, then don’t worry let try it with a simple program.


Program to find out the greater number between two numbers. 

#include<stdio.h>

int main()

{

int a, b;

printf("Enter Number A & B = ");

scanf("%d%d", &a,&b);

if(a>b)

{

    printf("A is Greater than B");

}

else{

    if(b>a)

    {

        printf("B is Greater than A");

    }

    else{

        printf("Numbers are Equal");

    }

}

getch();

}

Output :- 

Explanation :-

First, we declare two integer variable name a and b. After the declaration of the variable name. We take input from the user in variable a and variable b. 

Now, we use nested if-else to check the greater number between a and b. So there are three possibilities that occur among checking the numbers. It should be:-

  • A is greater than B
  • B is greater than A
  • Both Number are Equal 

So, in the first if block of the part,  we check the condition. The condition is whether integer a is Greater than integer B if true then print the Message to the user that “A is greater than B”. if the first condition is true then the program is print the output.  Or if the condition is not true then the program will go on else block. 

Now, here are the two different conditions the first one is to check whether the integer B is Greater than A. If true then print the message to the user that “B is greater than B”. if this condition is not true then the else part is automatically executed by default.

Hope you all understood this. If you have any query then comment it down. For more keep visit here. 

Continue Reading →

4/4/21

If-Else Condition in C Programming Part - II

Hey Friend, till now we have studied about only if statement. If you do not know about IF statement please read the previous tutorial before reading this. In if statement whenever the condition is true a set of instructions will proceed running. But every coin has two faces, till now we only learned about one condition. If the condition is true then the code will execute. 

In high-level programming, you have to code both situations such as if the first condition is true then a set of instructions will execute & if the condition is not true then the second set of instructions execute. This work is done using if-else statements.

Syntax of IF-Else Condition 

If (condition)

{

Statement 1;

Statement 2;

So on…;

}

Else{

{

Statement 1;

Statement 2 and so on…;

}


Note that:-

1. The Statement inside if and else keyword and generally known as if block and else block respectively.

2. The parenthesis inside the if-else block can be dropped if there is only one condition exists. 

3. You should not use any condition in the else keyword. The statements under else will be executed only if the condition with if statement is false. So it is treated as the default choice.

4.  Notice that the else part or statement of the program is placed just below the if part. And the statement of those blocks has indented to the right. This is a formatting convention that means just to write a program easier or understandable way. Look at the below program to understand in a better way. 


Program to find that the given number is a positive number or a negative number. 

#include <stdio.h>

void main()

{

 int number;

 printf("Enter a number to check if it is negative or positive :");

 scanf("%d",&number);

 if(number<0)

 {

  printf("Number is negative"); 

 } 

 else

 {

  printf("Number is positive");

 }

}

Output :- 


Explanation of the Program

I have already told the meaning of these (include, printf, int main) functions earlier. If you don’t know please check the previous post. In this program, we declare a variable name (number) as an integer value given by the user. 

Now we are going to check the number whether it is a positive number or a negative number.  So in the if block we check, is this number is smaller than zero? If yes then the program of (if block) executes and gives us the output. 

Or if the number is greater than zero then the else block starts to execute and give us the output.


Hope you all understand the program and if you have any query then comment below I will definitely try to explain with another example.  


Continue Reading →

Follow on Twitter

Linkedin

Categories

Mad About Computer. Powered by Blogger.
This site is in no way affiliated with or endorsed by specified business. It exists as a compendium of supporting information intended for informational purposes only. If you want to buy this website, please don't hesitate to contact us via e-mail: "d e n a c c 9 7 7 (at) g m a i l (dot) c o m" (delete spaces) or you can find and buy it on Afternic domain auctions.