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
C Language , C Programs, Data Structures, Simplified C programs, easy C programs
Search This Blog
Thursday, March 12, 2015
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)