google.com, pub-8786015629279405, DIRECT, f08c47fec0942fa0 Write a Program to Print Constant and Variable with Different Ways

Write a Program to Print Constant and Variable with Different Ways

0


// Write a Program to Print Constant and Variable with Different Ways 

//to show the Constant value never change.

#include <stdio.h>

#include <conio.h>

void main()

{

    int var;

    const int con=20;

    var=10;

    printf("The Value of the Variable Before updation is = %d\n",var);

    printf("The Value of the Constant Before updation is = %d\n",con);

 // Try to Update the Value Again

    var=20;

    con=30;

// we can not update the constant value other wise give the error

    printf("The Value of the Variable after updation is = %d\n",var);

    printf("The Value of the Constant after updation is = %d\n",con);

Output





//In the above program we can not update the constant value now try to update in the variable value only.

#include <stdio.h>

#include <conio.h>

void main()

{

    int var;

    const int con=20;

    var=10;

    printf("The Value of the Variable Before updation is = %d\n",var);

    printf("The Value of the Constant Before updation is = %d\n",con);

 // Try to Update the Value Again

    var=20;

// we can update the Variable value.

    printf("The Value of the Variable after updation is = %d\n",var);

    printf("The Value of the Constant after updation is = %d\n",con);

Output

The Value of the Variable Before updation is = 10

The Value of the Constant Before updation is = 20

The Value of the Variable after updation is = 20

The Value of the Constant after updation is = 20


Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Thank you for your interest 😊

We will back shortly after reviewing...

Thank you for your interest 😊

We will back shortly after reviewing...

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top