Answer» Mr. Yuganda is an astrologer. To impress people, he asks people their birth date & immediately tells them the day when they were born and number of Sundays in that year. For e g, he asked me my birth date i.e., 23rd July 1989. And he said me that it was Sunday, which was correct and number of Sundays are 53. Your task is to write a program which will prove that it is simple work to calculate day and number of days in that year when user enters any date. Your program should ask for date, month, year separated by “/”. If it is VALID then it should print the day. e.g. Input: Enter the date : 23/07/1989 Output: Entered date is 23rd April 1989 Leap year : NO Day is Sunday No. of days : 265 No. of Sundays : 53 Code Frenzy Page 2 of 9 Question 2 : Write a program to print following pattern 11234 54322 33456 76544 55678 (Note there is no gap between two rows and numbers). Question 3 : I am always interested in interchanging the digits in the number. One day I noticed that when I interchanged the position of the digits in the prime no., the new number is also the prime number, but this is not possible for all prime numbers. Then I came to the conclusion that some prime numbers are circularly prime numbers.( A circular prime is a prime number that remains prime on any cyclic rotation of its digits.)Find all such prime numbers up to the limit entered and total count of the numbers. Input Enter the limit: 100 Output: The numbers are: 2, 3, 5, 7, 13, 17, 37, 79 Total numbers are: 8 Code Frenzy Page 3 of 9 Question 4 : Everyone is having interest in the rearrangement. Find all such rearrangements possible with 0-9 digits without repetition of digits in the number and count them. The number should CONTAIN distinct digits. The number should not start from digit 0. e.g. Output 8547963120,1509784632. Total numbers: ------------------------------------------------------------------------------------------------ Question 5 : Mr.Gaikwad always like to find the numbers which are Palindrome (A palindrome is a word or sentence that reads the same forward as it does backward e.g.121) in radix 10 (decimal numbers) and in given radix. Find all such numbers and count them.Your program should take radix as input and count all numbers upto 1000000. Note : - Radix means base of that number.10-decimal,2-binary,8-octal,etc Radix must be greater than 0 and less than 10. e.g. Input : - Enter radix : - 2 Code Frenzy Page 4 of 9 Output : - Decimal Radix -2 5 101 Total number : - ... ------------------------------------------------------------------------------------------------ Question 6 : Write a program which prints the following pattern : 1 2 3 4 5 4 3 2 1 2 3 4 5 5 4 3 2 3 4 5 5 4 3 4 5 5 4 5 5 ------------------------------------------------------------------------------------------------ Question 7: File Handling is always very interesting part of C/C++ language. But the information stored in the file might be understandable to other users, hence some sort of cryptography is required. I think that reversing of the words in the statement of the file is the better cryptography. Write a program to take input file name which contain well indented matter, and your program should create a new file which contains the line-wise reverse words but KEEPING the paragraph same and display the contents of the new file. Code Frenzy Page 5 of 9 e.g. Suppose Code.txt contains the following data C language was developed by Dennis Ritchie. It was developed in AT&T Bell Labs.C language is the higher level language. Input :- Enter file name : Code.txt Output : - File name :-Crypt_code.txt Contents: - Ritchie Dennis by developed was language C. Labs Bell AT&T in developed was It. Language level higher the is language C. Questions 8. I am a strong supporter of C language. I believe that any database can be designed with using C-programming language. Support me by writing an application that will perform following operations on the employee database 1.Insertion of record in the file Note: - Employee database contains attributes Emp_no, Name,Salary,Address,Pin_code,Phone_no. 2.Display the coloumn according to given ATTRIBUTE. Code Frenzy Page 6 of 9 If you enter Name and Salary,then the output should be Name and respective salary and it should be properly arranged in two columns. Your program should take attributes as input from the user. Sample Output: Name Salary Sunil Gaikwad 35000 Saurabh Atkari 30000 3. Sorting of the records According to the given attribute. Your program should take input attribute from user and according that attribute your program should sort the records in the file. Sorting must in ascending order. e.g. Input : Name Output : Contents of the file Name Salary Saurabh Atkari 30000 Sunil Gaikwad 35000 Your whole program should go like this. Code Frenzy Page 7 of 9 Menu 1. Insert a record in the file. 2. Display the records 3. Sort the records 4.Exit Enter your choice : ------------------------------------------------------------------------------------------------ Question 9: Write a program which has a function which will execute before main() and another function which will execute after main() function. And then prints the following output , when in the respective blocks: “Before main()” “In main()” “After main()” ------------------------------------------------------------------------------------------------ Code Frenzy Page 8 of 9 Questions 10: Write a program which prints screen full of blinking smiley and continue printing until any key is not pressed. Output: ------------------------------------------------------------------------------------------------ Thank You & Best of Luck ------------------------------------------------------------------------------------------------I told you yesterday you have to do your own homework.
|