Saturday, December 23, 2023

PALINDROME CHECKING

  CHECK THE CHARACTERS  ARE PALINFROME OR NOT 

🤔

what  palindrome ?

 word, number, phrase, or other sequence of symbols that reads the same backwards as forwards.peaples using lots of words in the palindrome without realizing it.A man, a plan, a canal: Panama! =>is the famous palindrome sentence.




   

We can find this palindrome in places like in numbers,words,names , sequence ....

Now write a code to find the input is palindrome or not .

-----------------------------------------------------------------------------------------------------------------------------



#include<stdio.h>
#include<string.h>//  In this program we use the strlen() function .so we need to include this                                 header file💡
void main()
{
int len,i,count=0,rev=0;
char c[20];
while(rev==0)
{
printf("enter the string \t:");
scanf("%s",&c);
len=strlen(c);     // strlen()this function can find the length of the character.{ hai=3}three is                                     the length of the character hai.

printf("total length is:%d\n",len);


for (i=0;i<len;++i)
{
if(c[i]==c[len-i-1])// len-i-1  = ex {  len =5,  5-0-1=4, again the loop will decrement the                                              value.                        
                                                                             how the looping will pros

{                                                                  ex len=5;
printf("palindrome\n");                            c[0]==c[4]
                                                                  c[1]==c[3]
}                                                                          c[2]==c[2]
else                                                                       c[3]==c[1]
                                                                                                c[4]==c[0]
{
printf("Not a palindrome\n");
}
}
printf("anything want to check again : 0=NO \t 1=YES\n");
scanf("%d",&rev);
}
}


this string palindrome will take the input value as a array conversion .and check the value from 0th array to last array.2nd array to 2nd from last in this format of  checking was perform in there.

__________________________________________________________________________
OUTPUT

enter the string        :mom

total length is:3
palindrome
palindrome
palindrome

anything want to check again : 0=NO      1=YES
1

enter the string        :malayalam

total length is:9
palindrome
palindrome
palindrome
palindrome
palindrome
palindrome
palindrome
palindrome
palindrome

anything want to check again : 0=NO      1=YES
1

enter the string        :good

total length is:4
Not a palindrome
palindrome
palindrome
Not a palindrome

anything want to check again : 0=NO      1=YES
0

-------------------------------------------------------------------------------------------------------------------------
SOME OF THE PALINDROME COLLECTIONS 




Words                             
  1. kayak
  2. racecar
  3. madam
  4. refer
  5. rotor
  6. deed
  7. noon
  8. tenet
  9. reviver
  10. redder
  11. civic
  12. malayalam
  13. NUMBERS
    1. 1331
    2. 1221
    3. 12321
    4. 454
    5. 909
    6. 1001
    7. 1441
    8. 3443
    9. 2002
    10. 1001
    11. SENTENCE
      1. Able was I ere I saw Elba."
      2. "A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal: Panama!"
      3. "Mr. Owl ate my metal worm."
      4. "Eva, can I see bees in a cave?"
      5. "Madam, in Eden, I'm Adam."
      6. "A Santa at NASA."
      7. "Never a foot too far, even."
      8. "Was it a car or a cat I saw?"
      9. "No lemon, no melon."
      10. "A man, a plan, a canal, analyze the panama canal map."
      11. ALL EXAMPLES REFERANCED BY GOOGLE 💡

Thursday, December 21, 2023

FIBONACCI METHOD in c

                                                FIBONACCI METHOD IN C

NOTE:

             The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, usually starting with 0 and 1. This program defines that generates and prints the Fibonacci series up to a specified number of terms. The main function takes user input for the number of terms and then to display the series.

This method to do the calculation between the previous value and the current value to get the next value.

            { 0     1     1     2    3    5     8       13      21 .   .    .    .   . .   .   .   .     .   n  }        

                                                             // FIBONACCI METHOD

___________________________________________________________________________________

#include<stdio.h>

void main()

{

int a=0,b=1,i,c,num;

printf("how many range of fibonacci series needed:");

    scanf("%d",&num);   


printf("%d\t %d\t",a,b);Prints the current value of first 2, which represents the current Fibonacci number.

for(i=2;i<=num;i++)      // The loop iterates num times, generating the specified number of terms in the Fibonacci series.

{

c=a+b;    // add the previous values                c=0+1  = 1;

printf("%d\t",c);

a=b;          //previous value for first  a=1;


                               //Updates the values of first and second to progress to the next Fibonacci number in the series.

b=c;         // current value for second b=1

  }  

}

In this fibonacci method can be implement in several ways.like in Recursion,With range of limit,using array ...We will know about it in later posts.

__________________________________________________________________________________

OUTPUT

how many range of fibonacci series needed:10

0        1      1       2       3       5       8       13      21      34      55


for reference:

c=a+b;


a=0,1,1,2,3,5;

b=1,1,2,3,5,8;

\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

 c=0+1=1 ;

 c=1+1=2;  

c=1+2=3;                              

c=2+3=5;

 c=3+5=8 ;

c=5+8=13;                          

\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\                                                                                                      

                 output =1,2.3,5.8,13....




Wednesday, December 20, 2023

CRICKET OVER AND ITS RUNS CALCULATION PROCESS IN c

 CRICKET OVER  AND ITS RUNS  CALCULATION PROCESS

// using for loop

//using else if ladder 

//color pg formatting detail

Scenario: In this cricket match a team is going to play six overs.At the end of each over                               announce the score of that over.After each over the next over should  be                                      announced .

MATCH START 


#include<stdio.h>

void main()

{

int ball,over,run,score=0,total_score;

over=1;//Defaultly set the over is 1


printf("------- T20------2023------\n");

for(over=1;over<=6;over++)

// for over=1 is initialization or entry level .

//over<=6 is the condition -- The program will enter only if that condition is true.otherwise it will exit.

//over++ is the increment operation its work like over+1.This operation is activated when the program enters after checking whether the condition is correct and returns to the top after completion of the program. 

{

printf("%d over is starts\n",over);

for(ball=1;ball<=6;ball++)

//We need to know one thing here.

                                                         if the program has two for condition.The first for condition is true then it will come in then when the condition in the for condition given inside is true it will do the job it is given for .Now the condition given inside is wrong .Its goes back to the first given for condition.

{

   if(ball==1){

    printf("Enter the first ball run :");

    scanf("%d",&run);

    score=run+score;

   

   }

   else if(ball==2)

   {

    printf("Enter the Second ball run :");

    scanf("%d",&run);

    score=run+score;

   

   }

    else if(ball==3)

   {

    printf("Enter the Third ball run :");

    scanf("%d",&run);

   

    score=score+run;

   

   }

    else if(ball==4)

   {

    printf("Enter the Forth ball run :");

    scanf("%d",&run);

   

    score=run+score;

   

   }

    else if(ball==5)

   {

    printf("Enter the Fifth ball run :");

    scanf("%d",&run);

    score=run+score;

   

   }

    else if(ball==6)

   {

    printf("Enter the Sixth ball run :");

    scanf("%d",&run);

   

    score=run+score;

   

   }

   

   else{

    printf("over is ended\n");

   }

 

}

printf("                               \t%d over end runs scored :%d\n",over,score);

system("color 0A");

/*in this program after the first 

over scores are added by

  the previous 

over runs*/

 

   

}

printf("\t----------match is ended--------------- .\n The total runs scored\n----------\n %d\n-------------",score);

printf("the total run scored :%d",score);

}

_________________________________________________________________________

NOTE:

// In this program,after the completion of each over,its run is added to the next over.

// if the given runs go above maybe 6 or 7 then it should not be taken as a run.we do not include this condition in this programm. 

-----------------------------------------------------------------------------------------------------------------------------

OUTPUT

------- T20------2023------

1 over is starts🏏

Enter the first ball run :1

Enter the Second ball run :1

Enter the Third ball run :2

Enter the Forth ball run :1

Enter the Fifth ball run :2

Enter the Sixth ball run :1

                                1 over end runs scored :8

2 over is starts🏏

Enter the first ball run :1

Enter the Second ball run :2

Enter the Third ball run :1

Enter the Forth ball run :2

Enter the Fifth ball run :1

Enter the Sixth ball run :2

                                2 over end runs scored :17

3 over is starts🏏

Enter the first ball run :1

Enter the Second ball run :2

Enter the Third ball run :1

Enter the Forth ball run :2

Enter the Fifth ball run :1

Enter the Sixth ball run :2

                                3 over end runs scored :26

4 over is starts🏏

Enter the first ball run :1

Enter the Second ball run :2

Enter the Third ball run :1

Enter the Forth ball run :2

Enter the Fifth ball run :1

Enter the Sixth ball run :2

                                4 over end runs scored :35

5 over is starts🏏

Enter the first ball run :1

Enter the Second ball run :2

Enter the Third ball run :1

Enter the Forth ball run :2

Enter the Fifth ball run :1

Enter the Sixth ball run :2

                                5 over end runs scored :44

6 over is starts🏏

Enter the first ball run :1

Enter the Second ball run :2

Enter the Third ball run :1

Enter the Forth ball run :2

Enter the Fifth ball run :1

Enter the Sixth ball run :2

                                6 over end runs scored :53

                                           ----------match is ended--------------- .

 The total runs scored🏁

-------------the total run scored :53-------------

Tuesday, December 19, 2023

CUSTOMER FRIENDLY FRUIT VENDOR MACHINE IN c

 FRUIT PURCHASE VENDOR MACHINE PROCESS  WITH  CUSTOMER FRIENDLY   🤝


Scenario: A customer goes to Aakash super market  the customer goes to buy fruits like apples🍎 ,orange🍊 ...

the customer wants to go to one of the vendor machine there and buy fruits as per her /his choice like in kilo gram or no of fruits and the total calculation ...                            




#include<stdio.h>
void main()
{
    int n_o_f,op=1,opn,bop;
float p_a_kg_p=200,c_o_b_f,p_a_p=15,n_o_f_kg,p_o_kg_p=300,p_o_p=8,p_gc_p=25,p_gc_kg_p=150,total_cost=0;

// defaultly i set the apple,orange and grape prices in kg and its single piece price.
while(op==1){
printf("Akash super market");
    printf("1.apple\n2.Orange\n3.grape\n");
printf("\t                     Enter the fruit choice :");
scanf("%d",&opn);  // customer would like to select anything of in this  options.
if(opn==1)
{

system("color 1A");// console area bg color and text color formatting. 
printf("APPLE\n");🍎
printf("Want to buy in kg press =1\n Want to buy in count=2\n");// choice depends upon the customer's mindset.customers have two option to buy one is in kilo gram㎏ and another one is in count🔢.
this process is help to easy the purchase process to the customers. 

printf("Enter the buy option :");
scanf("%d",&bop);
if (bop==1){
 
printf("Enter the no of kg :");
scanf("%f",&n_o_f_kg);
c_o_b_f=p_a_kg_p*n_o_f_kg;
total_cost= total_cost + c_o_b_f;// in this place the total will added one by one value before the current purchase.

printf("\t           cost for buying fruit :%.2f",c_o_b_f);
}
else if(bop==2){
printf("Enter the no of apples :");
scanf("%d",&n_o_f);
c_o_b_f=p_a_p*n_o_f;
total_cost=total_cost+c_o_b_f;
printf("\t            cost for buying fruit :%.2f\n",c_o_b_f);
}
}
else if (opn==2){
printf("orange\n");🍊
printf("Want to buy in kg press =1\n Want to buy in count=2\n");
    printf("Enter the buy option :");
    scanf("%d",&bop);
    if (bop==1){
 
printf("Enter the no of kg :");
scanf("%f",&n_o_f_kg);
c_o_b_f=p_o_kg_p*n_o_f_kg;
total_cost=total_cost+c_o_b_f;
printf("\t                    cost for buying fruit :%.2f\n",c_o_b_f);
}
else if(bop==2){
printf("Enter the no of ORANGE :");
scanf("%d",&n_o_f);
c_o_b_f=p_o_p*n_o_f;
total_cost=total_cost+c_o_b_f;
printf("\t                     cost for buying fruit :%.2f\n",c_o_b_f);
}
}
  else if (opn==3){
printf("grape\n");🍇
printf("Want to buy in kg press =1\n Want to buy in count=2\n");
    printf("Enter the buy option :");
    scanf("%d",&bop);
    if (bop==1){
 
printf("Enter the no of kg :");
scanf("%f",&n_o_f_kg);
c_o_b_f=p_gc_kg_p*n_o_f_kg;
total_cost=total_cost+c_o_b_f;
printf("\t                      cost for buying fruit :%.2f\n",c_o_b_f);
}
else if(bop==2){
printf("Enter the no of grapes cose :");
scanf("%d",&n_o_f);
c_o_b_f=p_gc_p*n_o_f;
total_cost=total_cost+c_o_b_f;
printf("\t                       cost for buying fruit :%.2f\n",c_o_b_f);
}
}

printf(".\n.\n IF YOU WANT TO CONTINUE \n 1=yes \t 0=no\n.\n.\n");
scanf("%d",&op);
// As seen earlier this condition take the program into loop .which means the process run again without have any execution .But the condition not satisfy the  entry level loop (While)the whole program will exit

}
printf("TOTAL AMOUNT : %.2f",total_cost);
}

//In this program we have learned.How customer can register in ihs/her own choice .This concept it will be not only at this place and also at various scenarios.We will know that in the upcoming posts

___________________________________________________________________________________
OUTPUT
1.apple
2.Orange
3.grape
                             Enter the fruit choice :1
APPLE
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :1
Enter the no of kg :1
                   cost for buying fruit :200.00.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.

1
____________________________________________________

1.apple
2.Orange
3.grape
                             Enter the fruit choice :1                                     🍎
APPLE
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :2
Enter the no of apples :2
                    cost for buying fruit :30.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
0               // in this place the loop add the previous purchase price and its carry that for nxt purchase.
TOTAL AMOUNT : 230.00
-----------------------------------------------------------------------------------------------------------------------------
1.apple
2.Orange
3.grape
                             Enter the fruit choice :2                                  🍊      
ORANGE
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :1
Enter the no of kg :1
                            cost for buying fruit :300.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
1
1.apple
2.Orange
3.grape
                             Enter the fruit choice :2
orange
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :2
Enter the no of ORANGE :2
                             cost for buying fruit :16.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
0
TOTAL AMOUNT : 316.00
-----------------------------------------------------------------------------------------------------------------------------
1.apple
2.Orange
3.grape
                             Enter the fruit choice :3                                    🍇       
GRAPE                                                       
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :1
Enter the no of kg :1
                              cost for buying fruit :150.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
1
1.apple
2.Orange
3.grape
                             Enter the fruit choice :3
grape
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :2
Enter the no of grapes cose :2
                               cost for buying fruit :50.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
0
TOTAL AMOUNT : 200.00


C Program Heading

#include <stdio.h> int main()

DDL command in sql

DATA DEFINITION LANGUAGE DBMS language database language are used to read,update and store data in a database.There are several suc...