Computer Science, asked by sehaj1415, 2 months ago

Write a program by using increment operator.​

Answers

Answered by ladenbehera662
1

Explanation:

#include<stdio.h>

int main()

{

int x = 12, y = 1;

printf("Initial value of x = %d\n", x); // print the initial value of x

printf("Initial value of y = %d\n\n", y); // print the initial value of y

y = ++x; // increment the value of x by 1 then assign this new value to y

printf("After incrementing by 1: x = %d\n", x);

printf("y = %d\n\n", y);

y = --x; // decrement the value of x by 1 then assign this new value to y

printf("After decrementing by 1: x = %d\n", x);

printf("y = %d\n\n", y);

// Signal to operating system everything works fine

return 0;

}

Answered by jhamaya913
9

Answer:

Here's u'r right, dear

Increment ++ and Decrement -- Operator as Prefix and Postfix:-

  • #include <stdio.h> int main() { int var1 = 5, var2 = 5; // 5 is displayed // Then, var1 is increased to 6. ...
  • #include <iostream> using namespace std; int main() { int var1 = 5, var2 = 5; // 5 is displayed // Then, var1 is increased to 6.

Hope this will helpful and Plz like my answer

Tqq uh so much to like my answer and Mark it as brainlist ❤️

Similar questions