Beruflich Dokumente
Kultur Dokumente
FRESHMAN ENGINEERING
DEPARTMENTMATION” 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
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.
Advantage
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.
We can make the Modern Periodic Table in C language by using three or more
header files or many data types such as:
AIM
Our main aim of this project is to transform the digits of the given number
based on the given conditions
• HARDWARE REQUIREMENTS:
The hardware requirements that map towards the software are as follows:
Step 1: Start
IMPLEMENTATION
#include<stdio.h>
#include<string.h>
int main()
int n,k,i,j;
scanf("%d %d",&n,&k);
char d[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.