Sie sind auf Seite 1von 10

K L UNIVERSITY

FRESHMAN ENGINEERING
DEPARTMENT​MATION​” we deal with lucky numbers
and arrays. Lucky numbers are the numbers formed with
only some particular digits and no other digit should be
intervened. This program deals with transformation of the
digits of the given lucky number as per the given
conditions. It had undergone through program design ,
program coding and program testing .This program is to
help PETYA,the boy in the program with his lucky
numbers. In this program we used strings instead of arrays
as we have to sort and swap the digits of a number, if we
had sort or swap numbers instead of digits we would have
used arrays. In this program we sorted the digits of the
number whenever 4,7 come side by side under given
conditions. When the no of digits in the given number are
odd and if 4,7 are side by side we transform both of them
as 4 or else we transform them as 7. This process should
be continued k number of times and the transformed string
should be displayed. K is given in the input.

INDEX

S.NO TITLE PAGE NO

1 INTRODUCTION 6-7
2 ADVANTAGES & DISADVANTAGES 7

3 AIM 8

4 SYSTEM REQUIREMENTS 9

5 FLOW CHART 10

6 ALGORITHM 10

7 IMPLEMENTATION 11

8 OUTPUT 12

9 CONCLUSION 12

INTRODUCTION
About C Language: ​C was originally developed at Bell Labs by Dennis
Ritche between 1972 and 1973 to make utilities running on Unix. Later, it was applied to
re- implementing the kernel of the Unix operating system. During the 1980s, C gradually
gained popularity. Nowadays, it is one of the most widely used programming lanuages,
with C compilers from various vendors available for the majority of existing computer
architectures and operating systems. C has been standardized by the ANSI since 1989
(see ANSI C) and by the International Organization for Standardization.

C is an imperative procedural language. It was designed to be compiled using a


relatively straightforward compiler to provide low-level access to memory and language
constructs that map efficiently to machine instructions, all with minimal runtime support.
Despite its low-level capabilities, the language was designed to encourage cross-
platform programming. A standards-compliant C program written with portability in mind
can be compiled for a wide variety of computer platforms and operating systems with
few changes to its source code. The language is available on various platforms, from
embedded microcontrollers to supercomputers.
C language always is popular now during programming industry meanwhile C++,
Java languages are also in top 3 as well as C language. By this time let us discuss
about its advantages and disadvantages. Every code or programming language own its
advantage, at the same time along with its development and optimization its
disadvantages and in-adaptability will embody. At the beginning, let us discuss its
advantages, then subsequently it is about disadvantages of C language.

Advantage

1. Concision and compact, flexibility and convenience


There are only 32 key words and 9 control statements in C language. The program is
free to write and case sensitive (lowercase and capital). Combine the basic structure
and statement of high-level language with the practicality of low-level language. C
language can operate on bits, bytes and addresses like assembly language, which are
the most basic unit of work of a computer.

2. Operators richness The operators of the C language contain a wide range of 34


operators. The C language handles parentheses, assignment, forced type conversion,
and so on. As a result, the C language has very rich computing types and various
expression types. Using various operators flexibly can achieve some operation, but
other high-level languages.

3. Data type rich The data types of C language include integer type, real type, character
type, array type, pointer type, structure type, union type, etc. It can be used to
implement various complex data structures. The concept of pointer is also introduced to
make the program more efficient.

4. Good program portability C compiler of C language on different computers, is


about 86% of the code as common, so the C language compiler is easy to portable.

5. Allows direct access to physical addresses, to operate on hardware Since C


language allows direct access to physical addresses and can operate directly on
hardware, it has both functions of high-level languages and many functions of
low-level languages. It can operate to bits, bytes, and addresses like assembly
language, which are the most basic unit of work of a computer and can be used to
write system software.
Disadvantage ​1. The disadvantage of C language mainly lies in the encapsulation of
data, which makes C
have great disadvantage in data security, which is also different from C and
C++.
2. The syntax restriction of C language is not strict, the type restriction of variable is not
strict, the security of program is affected, and the array subscript out of bounds is not
checked. From the perspective of application, C language is more difficult to master
than other high-level languages. That is to say, people who use C language need to be
more proficient in programming.

We can make the Modern Periodic Table in C language by using three or more
header files or many data types such as:

1. ​#include<stdio.h>​: This header file will contain scanf()-which is used take


input
from keyboard while running program, printf()-which is used to print output while
running program, and many more. 2. ​#include<conio.h>​: This header file will
contain clrscr()-which is used to clear
screen while running program, getch()-which is used to show characters while
running program, and many more. 3. ​#include<string.h>​: This header file will
contain some string based operations
such as strcmp()-which is used to compare strings, and many
more.

AIM

Our main aim of this project is to transform the digits of the given number
based on the given conditions

Advantages:- ​The features of this “LUCKY TRANSFORMATIONS “ is mainly related


to sorting and swapping. These are commonly used in various programs in our daily
life. They have a huge range of applications.
SYSTEM
REQUIREMENTS
• ​SOFTWARE REQUIREMENTS: ​The major software
requirements of the project are as follows:
Language : Turbo-C Operating system​:
Windows Xp or later.

• ​HARDWARE REQUIREMENTS:

The hardware requirements that map towards the software are as follows:

RAM : 2GB or Higher.

Processor : Dual core or Higher.


DATA FLOW DIAGRAM
ALGORITHM

Step 1: ​Start
IMPLEMENTATION
#include<stdio.h>

#include<string.h>

int main()

int n,k,i,j;

printf("enter the no of digits and no of times the condition should be


repeated\n");

scanf("%d %d",&n,&k);

char d[n];

printf("enter the number\n");

scanf("%s",&d);

for(i=1;i<=k;i++)
{

for(j=0;j+1<n;j++)

if(d[j]=='4'&&d[j+1]=='7')

if((j+1)%2!=0)
{

d[j]='4';

d[j+1]='4';

else if((j+1)%2==0)

d[j]='7';

d[j+1]='7';

printf("%s",d);

OUTPUTS

Screen Shots:
CONCLUSION
We have completed this project by using string sorting and transformations. This
program can be further made easy by using c++ or python. For now we have created
a lucky number transformer that transforms digits under given conditions.

Das könnte Ihnen auch gefallen