program to print the 10 numbers and also print the reverse of each number in c-proramming
In this program we will now input 10 numbers form the user by using array and print the number and also print the reverse of the each number in c-programming.
//program to print the 10 number and also print reverse of the number
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],b[10],i,n,num=0,rev=0;
printf("enter the 10 numbers:-");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++){
n=a[i];
num=0;
while(n!=0){
rev=n%10;
num=num*10+rev;
n=n/10;
}
b[i]=num;
}
for(i=0;i<10;i++)
printf("the number is %d and reverse is %d\n",a[i],b[i]);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],b[10],i,n,num=0,rev=0;
printf("enter the 10 numbers:-");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++){
n=a[i];
num=0;
while(n!=0){
rev=n%10;
num=num*10+rev;
n=n/10;
}
b[i]=num;
}
for(i=0;i<10;i++)
printf("the number is %d and reverse is %d\n",a[i],b[i]);
getch();
}
output:-
For more c-programming:-

No comments:
Post a Comment