Identification Division.
Program-id. Example1.
Data Division.
Working-storage Section.
01 Num1 Pic 999 Value Zeros.
01 Num2 Pic 9 Value Zeros.
01 Num3 Pic 99 Value 10.
01 Result Pic 999 Value Zeros.
01 Temp Pic 99.
Procedure Division.
Calculator.
Display "enter First Number :".
Accept Num1.
Perform Until Num1 = 0
Divide Num1 By Num3 Giving Temp Remainder Num2
Compute Result =(result * Num3) + Num2
Compute Num1 = Num1 / Num3
End-perform
Display "result Is=", Result.
Stop Run.
Use the following function to reverse a number:
unsigned reverse (unsigned num) {
unsigned accumulator=0;
while (num) {
accumulator *= 10;
accumulator += (num%10);
num /= 10;
}
return accumulator;
}
Note that if the number ends in 0 (no units), there will be no leading zero in the reversed number. To accommodate this, convert the number to a string then reverse the string. This is achieved by working from both ends of the string to the middle, swapping characters as we go:
void reverse_string (char* str) {
char *left, *right, temp;
unsigned len;
left = str;
right = str;
while (right) ++right; // traverse to null-terminator
len = (right-left)/2; // determine mid-point
while (len--) {
--right; // step back
// swap characters
temp=*left;
*left=*right;
*right=temp;
++left; // step forward
}
}
Answer1 int a = 10, int b = 20; int temp; Solution: a=temp --->> Assings temp = 10 a=b --->> Assigns a= 20 b=temp --->> Assigns b=10
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
COBOL is a business-oriented language that has a strong support for files, e.g., reading a file; performing any file operation is much simpler in COBOL than in other languages, such as C/C++. It has many built-in commands, e.g., edit-picture clause, redefines, rename facility, that are very useful for businesses.
A worker with knowledge and experience of Cobol can find employment as a computer programmer. A job available to someone with more experience and a mastery of Cobol would be in maintaining mainframe computers.
#include #include void main() { int rev num=0; while(num>0) { rev num=rev num*10+num%10; num=num%10; } return rev_num; } int main(); { int num=4562; printf("reverse of number is%d",reverse digit(num)); getch(); return o; }
#include <stdio.h> #include<conio.h> void main () { int a,r,n,sum=0; clrscr(); printf("enter the number"); scanf("%d",& n); c=n while (n!=0) { a=n%10; n=n/10; sum=sum*a+a } printf("the reverse is %d \n",sum); if(c==sum) printf("\n the given number is palindrome"); else printf("\n the given number is not a palindrome"); getch(); }
reverse programe in fox pro
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
Each question carries 10 marks. Explain the environment Division with example. Explain the Data Division with an example. Explain the various types of Move statements. Write a COBOL program to find a given integer is odd or even. An input file consists of the following Employee name, Employee number, Basic pay. Write a COBOL program to create an Indexed file which consists of Employee-name, Employee-number, Basic-pay and DA (DA = 25% of Basic-pay) Assume that an organisation has 20 departments. Each department has 5 stores. You are provided with total monthly sales of each stores for the month December 2000. Write a COBOL program to read the data, to write the sales report department wise and also write the total sales of the organisation.
123
You write the number and then follow it with the digits in reverse order.
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"
The reverse lookup is a telephone number data base. Instead of looking up a phone number based on a given name, a name can be looked up based on a given phone number. It is useful when receiving phone calls from an unknown phone number.
A worker with knowledge and experience of Cobol can find employment as a computer programmer. A job available to someone with more experience and a mastery of Cobol would be in maintaining mainframe computers.
COBOL is a business-oriented language that has a strong support for files, e.g., reading a file; performing any file operation is much simpler in COBOL than in other languages, such as C/C++. It has many built-in commands, e.g., edit-picture clause, redefines, rename facility, that are very useful for businesses.
#include #include void main() { int rev num=0; while(num>0) { rev num=rev num*10+num%10; num=num%10; } return rev_num; } int main(); { int num=4562; printf("reverse of number is%d",reverse digit(num)); getch(); return o; }
A mirror prime.
sdfsdfsfsggbcvbg