C Programming Examples with Output Part – 1
Program
![C Programming Examples with Output Part - 1 2024 c program examples, c programming examples with output, basic programs in c, c programs for practice, c language basics, c programs for interview, c programming questions, c programming tutorial, c program examples, basic programs in c, c programming software, c programming tutorial, c programs for practice, c programs with solutions, c program online compiler, c program examples, c program to add two numbers, c program compiler, c program to find factorial of a number, c program to reverse a number, c program to reverse a string, c program for prime number, structure of c program, hello world c program, leap year c program, bubble sort in c program, merge sort in c program, quick sort in c program,](http://www.ishwaranand.com/wp-content/uploads/2021/11/c-fundaments.jpg)
2) Write a program to accept two numbers & swap them without an extra (third) variable.
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b;
printf("Enter two numbers : ");
scanf("%d%d", &a, &b);
printf("nOriginal values are a = %d b = %d", a, b);
a = a + b;
b = a - b;
a = a - b;
printf("nAfter exchange a = %d b = %d", a, b);
getch();
}
Output:
Enter two numbers: 10 20
Original values are a = 10 b = 20
After exchange a = 20 b = 10
3) What is the output of the following program? – 3 Number value equation
void main()
{
int intN = 55;
int intM = 10;
char X = 'A' ;
intN +=50;
printf("1. Updated value of intN ID % FN", X);
printf("2. Updated value of X is % dn", X);
X='B';
printf("3. Updated value of X is % cn", X);
intN -=8;
printf("4. Updated value of intN is %dn",intN);
intN++;
printf("5. Updated value of intN is %dn", intN);
intN= intN++ + ++ItM;
printf("6. Updated value of intN is ;%d intM is;%dn", intN, intM);
}
Output:
1. Updated value of intN is 105
2. Updated value of X is 65
3. Updated value of X is B
4. Updated value of intN is 97
5. Updated value of intN is 98
6. Updated value of intN is:110 intM is:11