#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int r=0,d,m,n;
printf("Enter a value=");
scanf("%d",&n);
m=n;
do
{
d=m%10;
m=m/10;
r=(r*10)+d;
}
while(m!=0);
printf("%d is the reverse",r);
getch();
}
#include<stdio.h>
void main()
{
int *p,n,s=0;
print f("Enter Number :");
scan f("%d",&n);
for(p=&n;*p>0;p++)
{
s=s*10+*p%10;
*p=*p/10;
}
printf("Reverse Number=%d",s);
}
for(int i = MAX_NUM; i >= 0; i--)
printf("%d\n", i);
wap to print all the arnstrong no. between 100&1000
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
public class StringReverseExample { public static void main(String[] args) { int num=1001; int n=num, rev; while(num!=0) { int d=num%10; rev= (rev*10)+d; num=num/10; } System.uot.println(rev); } }
i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?
The print command is a way to display output to the console. The hello world program, for example, can be written in python as simply print("Hello world") Other values can also be used in a print statement: a = 4 print(a) #will print the number 4
In python, type the following into a document. NOTE: Sentences following a # symbol are comments, and are not necessary for the program to run. #!/usr/bin/python #This program takes a input from a user and reverses it. number = input("Type a number: ") #This takes input from a user. a = len(number) #This finds the length of the number reverse = "" #This sets the variable reverse to an empty string. for i in number: a = a-1 #The places in a string start from 0. The last value will be the length minus 1.reverse = reverse + number[a] #Makes the number's last digit the new string's first. print("The reverse of", number, "is", reverse + ".") #prints the resulting string. This program will take any sequence of characters and reverse them. The final value is a string, but if an integer is needed, one needs only to add the line reverse = int(reverse) above the print statement. However, this will stop the program from being able to reverse strings, as it is not possible to convert a string to an integer if it is not a number.
To check if a number is a palindrome, reverse the number and see if it is equal to the original number. If so, the number is a palindrome, otherwise it is not. To reverse a number, use the following function: int reverse(int num, int base=10) { int reverse=0; while( num ) { reverse*=base; reverse+=num%base; num/=base; } return(reverse); }
question clarity
first sort the ten numbers in descending order and print the first number. That will be the largest no
bghjg
Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.
wap to print all the arnstrong no. between 100&1000
#include<stdio.h> void main() { int *p,n,s=0; printf("Enter Number :"); scanf("%d",&n); for(p=&n;*p>0;p++) { s=s*10+*p%10; *p=*p/10; } printf("Reverse Number=%d",s); }
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
public class StringReverseExample { public static void main(String[] args) { int num=1001; int n=num, rev; while(num!=0) { int d=num%10; rev= (rev*10)+d; num=num/10; } System.uot.println(rev); } }
echo "enter the number" if [ $# -ne 1 ] then echo "Usage: $0 number" echo " I will find reverse of given number" echo " For eg. $0 12321, I will print 12321" exit 1 fi n=$1 rev=0 sd=0 while [ $n -gt 0 ] do sd=`expr $n % 10` rev=`expr $rev \* 10 + $sd` n=`expr $n / 10` done echo "Reverse number is $rev"
There is no such thing as 'the greatest number'. Here is a program in unix to prove it: echo 'for (i=1; i>=0; i= i*2) print i,"\n";' | bc if you want to actually see the output use it this way: echo 'for (i=1; i>=0; i= i*2) print i,"\n";' | bc | less -S