C Program to interchange the value of two variables without using third variable. C Programming. Interchanging Variables.
#include <stdio.h>
void main()
{
int a,b;
a=20, b=30;
b=a+b;
a=b-a;
b=b-a;
printf("a=%d b=%d", a,b);
}
C Language , C Programs, Data Structures, Simplified C programs, easy C programs
Search This Blog
Tuesday, April 21, 2015
Tuesday, April 7, 2015
C Programming | C Programs | C Examples | C Program to find greatest of three numbers
C Programming | C Programs | C Examples | C Program to find greatest of three numbers
#include <stdio.h>
void main ()
{
int a,b,c;
printf( "Enter three numbers:");
scanf("%d %d %d ", &a, &b,&c);
if (a>b)
{
if (a>c)
printf("%d is Big",a);
else
printf("%d is Big",c);
}
else
{
if (b>c)
printf("%d is Big",b);
else
printf("%d is Big",c);
}
}
#include <stdio.h>
void main ()
{
int a,b,c;
printf( "Enter three numbers:");
scanf("%d %d %d ", &a, &b,&c);
if (a>b)
{
if (a>c)
printf("%d is Big",a);
else
printf("%d is Big",c);
}
else
{
if (b>c)
printf("%d is Big",b);
else
printf("%d is Big",c);
}
}
Thursday, March 12, 2015
C Program to Reverse a four digit number| C Programming
C Program to Reverse a four digit number| C Programming, C Programs
#include<stdio.h>
int main()
{
int N, a,b,c,d,e;
printf("Enter the four digit number:");
scanf("%d",&N);
a=N%10;
b=((N-a)%100)/10;
c=((N-a-b*10)%1000)/100;
d=N/1000;
e=a*1000+b*100+c*10+d;
printf("\nThe reversed number is: %d",e);
return 0;
}
Output:
Enter the four digit number:1234
a=4
b=3
c=2
d=1
e=4321
The reversed number is :4321
#include<stdio.h>
int main()
{
int N, a,b,c,d,e;
printf("Enter the four digit number:");
scanf("%d",&N);
a=N%10;
b=((N-a)%100)/10;
c=((N-a-b*10)%1000)/100;
d=N/1000;
e=a*1000+b*100+c*10+d;
printf("\nThe reversed number is: %d",e);
return 0;
}
Output:
Enter the four digit number:1234
a=4
b=3
c=2
d=1
e=4321
The reversed number is :4321
Monday, March 9, 2015
Hello World C Program........| C Programming| Begin C Programming
Hello World C Program........| C Programming| Begin C Programming
#include <stdio.h>
int main()
{
printf("Hello World.\n");
return 0;
}
#include <stdio.h>
int main()
{
printf("Hello World.\n");
return 0;
}
Thursday, March 5, 2015
C Program for Multiplication of Two variables| C Program to multiply two numbers using scanf
C Program for Multiplication of two numbers. C program for multiplication of two integers, variables, numerals.
void main()
{
int i, j,k;
printf("Enter the two numbers to be multiplied--");
scanf("%d%d",&i,&j);
k=i*j;
printf("\Multiplication of %d and %d is =%d",i,j,k);
}
void main()
{
int i, j,k;
printf("Enter the two numbers to be multiplied--");
scanf("%d%d",&i,&j);
k=i*j;
printf("\Multiplication of %d and %d is =%d",i,j,k);
}
C Program to Subtract two Numbers| C Program to Subtract two variables, numerals
C Program for Subtraction of two numbers. C program for Subtraction of two integers, variables, numerals
void main()
{
int i, j,k;
printf("Enter the two numbers to be Subtracted--");
scanf("%d%d",&i,&j);
if (i>j)
k=i-j;
void main()
{
int i, j,k;
printf("Enter the two numbers to be Subtracted--");
scanf("%d%d",&i,&j);
if (i>j)
k=i-j;
else
k=j-i;
printf("\nSubtraction of %d and %d is =%d",i,j,k);
printf("\nSubtraction of %d and %d is =%d",i,j,k);
}
Subscribe to:
Comments (Atom)