0% found this document useful (0 votes)
159 views15 pages

K L University Freshman Engineering Department: A Project Based Lab Report On Lucky Transformation

The document describes a project to transform numbers into lucky numbers for a student named Petya. It provides the student's initial number as an array of digits and the number of operations, k, to perform. The operations involve finding digits that are 4 and 7 in specific positions and reassigning them, with the goal of producing a number with only the lucky digits 4 and 7. The project implements an algorithm to perform this transformation k times on the initial number and outputs the resulting lucky number.

Uploaded by

Javvaji Pavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views15 pages

K L University Freshman Engineering Department: A Project Based Lab Report On Lucky Transformation

The document describes a project to transform numbers into lucky numbers for a student named Petya. It provides the student's initial number as an array of digits and the number of operations, k, to perform. The operations involve finding digits that are 4 and 7 in specific positions and reassigning them, with the goal of producing a number with only the lucky digits 4 and 7. The project implements an algorithm to perform this transformation k times on the initial number and outputs the resulting lucky number.

Uploaded by

Javvaji Pavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

K L UNIVERSITY

FRESHMAN ENGINEERING DEPARTMENT


A Project Based Lab Report

On

LUCKY TRANSFORMATION

SUBMITTED BY:

I.D NUMBER NAME

2000031537 G.KARTHIKEYA

2000031539 KONDI UMA MAHESWARA RAO

2000031540 BOMMINENI VENKATA AVINASH


CHOWDARY

UNDER THE ESTEEMED GUIDANCE OF

B.PREMALATHA WILLIAMS

ASST.PROFESSOR(CSE)

KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
DEPARTMENT OF BASIC ENGINEERING SCIENCES

CERTIFICATE

This is to certify that the project based laboratory report entitled


“LUCKY TRANSFORMATION” submitted by Mr. G.KARTIKEYA ,Mr.KONDI UMA
MAHESWAR RAO,Mr.BOMMINENI VENKATA AVINASH CHOWDARY bearing
Regd. No. 2000031537,2000031539,2000031540 and to the Department of
Basic Engineering Sciences, KL University in partial fulfillment of the
requirements for the completion of a project based Laboratory in “Computational
Thinking and Designing” course in I B Tech I Semester, is a bonafide record of the
work carried out by his/her under my supervision during the academic year 2020
– 2021.

PROJECT SUPERVISOR HEAD OF THE DEPARTMENT

B.PREMALATHA WILLIAMS
Dr. D.HARITHA
ACKNOWLEDGEMENTS

It is great pleasure for me to express my gratitude to our honorable


President Sri. Koneru Satyanarayana, for giving the opportunity and platform
with facilities in accomplishing the project based laboratory report.

I express sincere gratitude to our Coordinator and HOD-CSE Dr. D.Haritha


for her leadership and constant motivation provided in successful completion of
our academic semester. I record it as my privilege to deeply thank for providing
us the efficient faculty and facilities to make our ideas into reality.

I express my sincere thanks to our project supervisor B.PREMALATHA


WILLIAMS for her novel association of ideas, encouragement, appreciation and
intellectual zeal which motivated us to venture this project successfully.

Finally, it is pleased to acknowledge the indebtedness to all those who


devoted themselves directly or indirectly to make this project report success.

Name: G.KARTHIKEYA

KONDI UMA MAHESWAR RAO

BOMMINENI VENKATA AVINASH


CHOWDARY

Regd . No: 2000031537


2000031539,2000031540

ABSTRACT
Petya loves lucky numbers. Everybody knows that lucky numbers are positive
integers whose decimal representation contains only the lucky digits 4 and 7. For
example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya has a number consisting of n digits without leading zeroes. He represented it
as an array of digits without leading zeroes. Let's call it d. The numeration starts
with 1, starting from the most significant digit. Petya wants to perform the
following operation k times: find the minimum x (1 ≤ x < n) such that dx = 4 and
dx + 1 = 7, if x is odd, then to assign dx = dx + 1 = 4, otherwise to assign dx = dx +
1 = 7. Note that if no x was found, then the operation counts as completed and the
array doesn't change at all.
You are given the initial number as an array of digits and the number k. Help Petya
find the result of completing k operations.
Input
The first line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 109) — the
number of digits in the number and the number of completed operations. The
second line contains n digits without spaces representing the array of digits d,
starting with d1. It is guaranteed that the first digit of the number does not equal
zero.
Output
In the single line print the result without spaces — the number after the k
operations are fulfilled
INDEX
S.NO TITLE PAGENO

1 Introduction <pageno>

2 Aim of the Project <pageno>

2.1 Advantages & Disadvantages <pageno>

2.2 Future Implementation <pageno>

3 Software & Hardware Details <pageno>


4 Data Flow Diagram <pageno>

5 Implementation <pageno>

6 Algorithm for each module <pageno>

7 Integration and System Testing <pageno>

8 Conclusion <pageno>
INTRODUCTION

Everybody knows that lucky numbers are positive integers whose


decimal representation contains only the lucky digits 4 and 7.For
example number 47,744,4 are lucky where as 5,16,467 are not. Here,
in the given question Petya has a number consisting of n digits without
leading zero

USED STRINGS CONCEPT (STRING LENGTH),FOR LOOP AND IF ELSE STATEMENTS


AIM
TO FIND THE LUCKY NUMBER OF PETYA WHO IS GIVEN THE INTIAL NUMBERS AS
AN ARRAY OF DIGITS AND NUMBER K.
Advantages:- A lucky number attracts goodness to the person with the
number. A lucky number attracts goodness to the person with the number.
Numerology lucky numbers represent the energy that resonates with the
person's birth date and name. It attracts events and circumstances with similar
resonance.
Disadvantages:- It creates situations in life that continue to occur in the same
pattern though the design on the outside may be different. It is a perfect
example of human life.
Future enhancements:- - It may surprise you to learn that your winning wasn't
just a series of random events that produced what is termed as "luck." In
numerology, there are no random acts, only a deliberate ordering of a series of
numerical events that literally adds up to the number that's lucky for you.
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 :8 GB

Processor : i5,10 TH GEN


DATA FLOW DIAGRAM
ALGORITHM

1.start
2.analyse the given lucky numbers
(4 and 7)
3.develop the formation
4.complete coding
5.stop
IMPLEMENTATION

#include<stdio.h>
#include<string.h>
int n, k, length;
char s[1000];
int main()
{
scanf("%d %d",&n,&k);
scanf("%s",s);
length=strlen(s);
for(int i=0;i<length-1;i++)
{
if(k==0) break;
if(s[i]=='4'&&s[i+1]=='7')
{
if(i>0&&s[i-1]=='4')
{
if(i%2){
if(k%2) s[i]='7';
k=0;continue;
}
}
if(i%2) s[i]='7';

else s[i+1]='4';
k--;
}
}
printf("%s",s);
return 0;
}
INTEGRATION AND SYSTEM TESTING
OUTPUTS
Screen Shots:
CONCLUSION
We have successfully completed the project “LUCKY TRANSFORMATION” in
simple way. And given all test cases and everything is passed

You might also like