Thursday 27 May 2021

C problems

 

#include<stdio.h>
void main()
{
int y;
float n;
y=30.20;
n=50;
printf("answer is %d\t%f",y,n);


}

2.)
#include<stdio.h>
void main()
{

int pq ;
printf ( "Enter values of p and q" ) ;
scanf ( " %d %d "pq ) ;
printf ( "p = %d q =%d"pq ) ;




}

3.)
//write a program to find the expotential value of any number
//author:upendra
#include<stdio.h>
#include<math.h>
void main()
{
int a;
float expo_a;
printf("Enter the number to find the expotential of a :\n");
scanf("%d",&a);
expo_a=exp(a);

printf("expotential of e raise to a is %f",expo_a);



}

4.)
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
float n,i,j,t,s;
printf("Enter the size of fish\n");
scanf("%f",&n);
n=n+14;
s=n/10;
t=4.72/n;
for(j=floor(s);j>=-ceil(s);j--){
for(i=0;i<=4;i=i+t){
if((j<s/2 && j>s/4 && i<1 && i>0.8||j==0 && i<0.6)||(pow(j/s,2)>=pow(sin(i),2))){
        printf(" ");
    }
else {
    printf("*");
}
}
printf("\n");
}
return 0;
}

5.)
#include<stdio.h>
#include<stdlib.h>
void main()
{
int x,y,N=20;
for(y=0;y<=20;y++)
{
for(x=0;x<=20;x++)
{
if(((x-10)*(x-10)/54 +(y-10)*(y-10)/25<=1)||((x-25)*(x-25)/54+(y-10)*(y-10)/25<=1))
{
printf("*");
}
else
{
printf(" ");
}
}

printf("\n");

}
}

6.)
//write a program to find sum of five digits number
//author :upendra yadav date:10/28/2020
#include<stdio.h>
void main()
{
int N,sum=0,rem,sum1,sum_avg,X//X is a variable to stored five digits number
printf("Enter the five digits number:\n");
scanf("%d",&N);
while(N!=0)
{
    sum1=N%10;
    rem=sum+sum1;
    X=N/10;
    sum_avg=rem+X;







}

printf("Sum of digits is %d ",sum_avg);






}

7.)
#include<stdio.h>
void first();
void second();
void third();
void four();
void five();
void main()
{
printf("Hello to the no world\n");
first();


}
void first()
{
printf("welcome to home to first person\n");
five();

}
void five()
{
printf("Welcome Home fiveth\n");
four();


}
void four()
{
printf("Welcome bro four\n");
second();



}
void second()
{
printf("Holi hai bro second\n ");
third();
}
void third()
{
printf("Welcome to last fuctions\n");

}

6.)
#include<stdio.h>
float subt(float,float);
void main()
{
float x,y,sub;
printf("enter the two values:");
scanf("%f%f",&x,&y);
sub=subt(x,y);
printf("answer is %f",sub);

}
float subt(float a,float b)
{
float ans;
ans=a-b;
return ans;
}

7.)
//write a program to for just fun
// author:upendra yadav
#include<stdio.h>
void main()
{
int num; // num- is any number you enter
printf("Enter any number:\n");
scanf("%d",&num);
printf("Yours secret number is %d",num);




}

8.)
#include<stdio.h>
void home();
void main()
{
printf("Hello buddy\n");
home();

}
void home()
{
printf("Welcome to Home");
}

9.)
// write a program for basic geometry of
//rectangle and circle
//author:upendra yadav date:10/27/2020
#include<stdio.h>
void main()
{
int lg,bd,rd,area_rec,area_cir,peri_rec;
float circum_cir;
printf("Enter the length and breath of a rectangle:\n");
printf("Enter the radius of a circle:\n");
scanf("%d%d%d",&lg,&bd,&rd);
area_rec=lg*bd;
peri_rec=2*lg+2*bd;
area_cir=rd*rd;
circum_cir=2*3.14*rd;
// answer is given below
printf("Area of Rectangle is %d\n",area_rec);
printf("Perimeter of a Rectangle is %d\n",peri_rec);
printf("Area of a Circle is %d\n",area_cir);
printf("Circumference of a Circle is %2f\n",circum_cir);









}

10.)
/* goto keyword is used
*/
#include<stdio.h>

void main()
{
 int i=1;

 if(i==1)
  goto one;
 else if(i==2)
  printf("2");
 else
  printf("Its nothing");

 one:
 printf("Avoid goto keyword");
}


11.)
//write a program to find the grade of a individual
//author:upendra
#include<stdio.h>
void main()
{
int grade,Result;
printf("Enter the grade of a student:\n");
scanf("%d",grade);
Result=(grade>=35)?pass:fail;
printf("result is %d",Result);



}


12.)
//write a program to find the grade of person
//author:upendra
#include<stdio.h>
void main()
{
int grade;
printf("Enter the grade of student:\n");
scanf("%d",&grade);
printf("%s\n",grade>=35?"pass":"fail");


}

13.)
// write a rogram using not operator
//author:upendra date:10/29/2020
#include<stdio.h>
void main()
{

int y;
printf("Enter the Input in terms of y:\n");
scanf("%d",&y);
if(y<=7)
printf("Yo upendra whats happen@@");
else
{
printf("Invalid Input");
}






}

14.)
#include<stdio.h>
void main()
{
int q;
for(q=0;q<=0;q--)
printf("system is hacked %d\t",q);


}

15.)
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<dos.h>
int i,j,k,l;
char ha[20][20] = {'H','A','P','P','Y',' ','B','I','R','T','H','D','A','Y'}, you[100];
void main()
{
int coun = 1, n;
char r[200], r1[200];

printf("Enter your friend's name to wish ");
gets(you);

do
{
printf("  \n\n\t\t\tBirthday Wishes Platform");
printf("\n\n\t\t\t 1.Box Wishes");
printf("\n\t\t\t 2.Hide and Seek Wishes");
printf("\n\t\t\t 3.Journey to Wish");
printf("\n\t\t\t 4.Smiley Wishes");
printf("\n\t\t\t 5.FLASH NEWS");
printf("\n\t\t\t Press any key other than 1-5 to exit");
printf("\nToday is Your Birthday so Choose what you like to choose %s:",coun==1?"First":coun==2?"Second":coun==3?"Third":coun==4?"Fourth":coun==5?"Fifth":coun==6?"Sixth":"");
scanf("%d",&n);
coun++;
if(n>7||n<=0)
exit(0);
switch(n)
{
case 1:
show1();
break;
case 2:
show2();
break;
case 3:
show3();
break;
case 4:
show4();
break;
case 5:
show5();
break;
default:
exit(0);
}
}while(n>0||n<=7);
getche();
}
show1()
{
for(i=5;i>0;i--)
{

printf("\n\n\n\n\t\t\tBox will Appears within %ds",i);
sleep(1);
}
clrscr();
printf("\t");
for(i=0;i<1;i++)
{
for(j=0;j<14;j++)
{
printf("%4c",ha[i][j]);
}
}
printf("\n\t\t\t");
for(i=0;i<1;i++)
{
for(j=0;j<14;j++)
{
sleep(1);
if(j==5)
{
sleep(2);
printf("\n\t\t\t  HAPPY BIRTHDAY FRIEND\n\t\t\t\t %s", you);
continue;
}
printf("\n%10c\t\t\t\t\t\t\t%c",ha[i][j],ha[i][j]);
}
}
printf("\n\t\tGOD BLESS YOU & ALL YOUR DESIRES COMES TRUE");
sleep(4);
clrscr();
return 0;
}
show2()
{
clrscr();
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tHide & Seek Starts in %ds",i);
sleep(1);
}
clrscr();
sleep(1);
printf("\n HH   HH");
printf("\n HHHHHHH");
printf("\n HH   HH");
sleep(1);
clrscr();
printf("\n%20s","AAAAAAA");
printf("\n%20s","AA   AA");
printf("\n%20s","AAAAAAA");
printf("\n%20s","AA   AA");
sleep(1);
clrscr();
printf("\n");
printf("\n%50s","PPPPPPP");
printf("\n%50s","PP     PP");
printf("\n%50s","PP     PP");
printf("\n%50s","PPPPPPPPP");
printf("\n%50s","PP       ");
printf("\n%50s","PP       ");
sleep(1);
clrscr();
printf("\n\n");
printf("\n%30s","PPPPPPP");
printf("\n%30s","PP     PP");
printf("\n%30s","PP     PP");
printf("\n%30s","PPPPPPPPP");
printf("\n%30s","PP       ");
printf("\n%30s","PP       ");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n\t\tYY     YY");
printf("\n\t\t YY   YY");
printf("\n\t\t  YY YY ");
printf("\n\t\t    Y   ");
printf("\n\t\t    Y   ");
sleep(1);
clrscr();
printf("\n\n\n");
printf("\n%60s","BBBBBBBBBB");
printf("\n%60s","BB      BB");
printf("\n%60s","BB      BB");
printf("\n%60s","BBBBBBBBBB");
printf("\n%60s","BB      BB");
printf("\n%60s","BB      BB");
printf("\n%60s","BBBBBBBBBB");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n\n");
printf("\n%30s","   IIIIII");
printf("\n%30s","     II  ");
printf("\n%30s","     II  ");
printf("\n%30s","     II  ");
printf("\n%30s","   IIIIII");
sleep(1);
clrscr();
printf("\n\n");
printf("\n%20s","  RRRRRRR");
printf("\n%20s","  RR     RR");
printf("\n%20s","  RR     RR");
printf("\n%20s","  RRRRRRRRR");
printf("\n%20s","  RR RR    ");
printf("\n%20s","  RR   RR  ");
printf("\n%20s","  RR     RR");
sleep(1);
clrscr();
printf("\nTTTTTTTT");
printf("\n   TT   ");
printf("\n   TT   ");
printf("\n   TT   ");
sleep(1);
clrscr();
printf("\n");
printf("\n%10s"," HH   HH");
printf("\n%10s"," HHHHHHH");
printf("\n%10s"," HH   HH");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf("\n%35s"," DDDDDDD");
printf("\n%35s","   DD    DD");
printf("\n%35s","   DD    DD");
printf("\n%35s","   DD    DD");
printf("\n%35s"," DDDDDDD");
sleep(1);
clrscr();
printf("\n");
printf("\n%80s","AAAAAAA");
printf("\n%80s","AA   AA");
printf("\n%80s","AAAAAAA");
printf("\n%80s","AA   AA");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n%10s","YY     YY");
printf("\n%10s"," YY   YY");
printf("\n%10s","  YY YY ");
printf("\n%10s","    Y   ");
printf("\n%10s","    Y   ");
sleep(1);
clrscr();
sleep(3);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n%20s HAPPY BIRTHDAY %s", "", you);
printf("\n\n\n\n\n\n\n\n");
printf("%30s","My Hearty wishes to you Friend...  ");
sleep(4);
clrscr();
return 0;
}
show3()
{
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tJourney Begins in %ds",i);
sleep(1);
}
clrscr();
printf("\n\t\t\t\tJourney to Wish a FRIEND");
printf("\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTenkasi");
printf("                                                                          %c",25);
sleep(1);
printf("\t                                                                          %c",25);
sleep(1);
printf("\t                                                                    %s","ALANGULAM");
sleep(2);
printf("\t                                                                          %c",25);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                    %cR %c Y %c G",178,177,176);
sleep(3);
printf("\t                                                                        %c ",188);
sleep(1);
printf("\t                                                  TIRUNELVELI WELCOMES YOU");
sleep(2);
printf("\t                                                                       %c",25);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                            %c%c%c%c%c%c%c%c%c%c%c",205,205,205,205,205,205,205,205,205,205,205,205,185);
sleep(2);
printf("\t                                                             PALYAMKOTTAI");
sleep(2);
printf("\t                                                          %c%c%c%c%c%c%c%c%c",201,205,205,205,205,205,205,205,205);
printf("\t                %c%c%cDR.SACOE%c%c%c%c%c%c%c%c%cKURUMBUR%c%c%c%c%c%c%c%cALWAR%c%c%c%c%c%cSeidunganallur",206,205,205,254,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205);
sleep(2);
clrscr();
printf("\t\t\t\tEEE DEPARTMENT");
sleep(1);
printf("\n\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
sleep(1);
printf("\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%cHAPPY BIRTHDAY %c\n\t\t\t%c     %s   %c\n\t\t\t%c               %c\n\t\t\t%c               %c",179,179,179,179,179,179,179,179,179,179,179,you,179,179,179,179,179);
sleep(1);
printf("\n\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,47);
sleep(4);
clrscr();
return 0;
}
show4()
{
clrscr();
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tSmileys Appears in %ds",i);
sleep(1);
}
clrscr();
for(i=0;i<=381;i++)
printf(" %c%c",1,2);
k=0;

for(i=0;i<15;i++)
{
printf(" %c",ha[k][i]);
sleep(1);
}sleep(1);printf("%s",you);sleep(1);
printf(" \n\t\tEVERY MOMENT IN YOUR LIFE WOULD BE FILLED WITH HAPPINESS ");
for(i=0;i<=319;i++)
printf("%c %c",1,2);
sleep(2);
clrscr();
return 0;
}
show5()
{
clrscr();
for(i=0;i<5;i++)
printf("\n");
printf("\n%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
printf("\n%c               %c       May Everyday Bring Something New and Exciting For You.  %c               %c  May This Birthday Turn Out To Be As Amazing As You.  \n%c               %c    \n%c      PHOTO    %c    .\"\n%c  LOADING...   %c\n%c               %c\n%c               %c",179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
printf("\n%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
for(i=0;i<6;i++)
printf("\n");
for(i=0;i<78;i++)
printf("%c",196);
for(i=0;i<4;i++)
{
if(i==0)
{
printf("\t\t\t\t");
call();
for(j=0;j<4;j++)
{
for(k=0;k<11;k++)
{
printf("\b");
}
sleep(1);
call(j);
}
}
for(k=0;k<11;k++)
printf("\b");
if(i==1)
 printf("\t\t\tHAPPY BIRTHDAY %s",you);
sleep(1);
sleep(1);
if(i==2)
printf("\n\t\t\t         by");
sleep(1);
if(i==3)
printf("\n\t\t       Best Friend");
}
sleep(6);
clrscr();

return 0;
}
call(int j)
{
 if(j==0)
printf("     FLASH  NEWS");
 if(j==1)
 printf("     FRESH  NEWS");
 if(j==2)
 printf("     NEWS UPDATE");
return 0;
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<dos.h>
int i,j,k,l;
char ha[20][20] = {'H','A','P','P','Y',' ','B','I','R','T','H','D','A','Y'}, you[100];
void main()
{
int coun = 1, n;
char r[200], r1[200];

printf("Enter your friend's name to wish ");
gets(you);

do
{
printf("  \n\n\t\t\tBirthday Wishes Platform");
printf("\n\n\t\t\t 1.Box Wishes");
printf("\n\t\t\t 2.Hide and Seek Wishes");
printf("\n\t\t\t 3.Journey to Wish");
printf("\n\t\t\t 4.Smiley Wishes");
printf("\n\t\t\t 5.FLASH NEWS");
printf("\n\t\t\t Press any key other than 1-5 to exit");
printf("\nToday is Your Birthday so Choose what you like to choose %s:",coun==1?"First":coun==2?"Second":coun==3?"Third":coun==4?"Fourth":coun==5?"Fifth":coun==6?"Sixth":"");
scanf("%d",&n);
coun++;
if(n>7||n<=0)
exit(0);
switch(n)
{
case 1:
show1();
break;
case 2:
show2();
break;
case 3:
show3();
break;
case 4:
show4();
break;
case 5:
show5();
break;
default:
exit(0);
}
}while(n>0||n<=7);
getche();
}
show1()
{
for(i=5;i>0;i--)
{

printf("\n\n\n\n\t\t\tBox will Appears within %ds",i);
sleep(1);
}
clrscr();
printf("\t");
for(i=0;i<1;i++)
{
for(j=0;j<14;j++)
{
printf("%4c",ha[i][j]);
}
}
printf("\n\t\t\t");
for(i=0;i<1;i++)
{
for(j=0;j<14;j++)
{
sleep(1);
if(j==5)
{
sleep(2);
printf("\n\t\t\t  HAPPY BIRTHDAY FRIEND\n\t\t\t\t %s", you);
continue;
}
printf("\n%10c\t\t\t\t\t\t\t%c",ha[i][j],ha[i][j]);
}
}
printf("\n\t\tGOD BLESS YOU & ALL YOUR DESIRES COMES TRUE");
sleep(4);
clrscr();
return 0;
}
show2()
{
clrscr();
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tHide & Seek Starts in %ds",i);
sleep(1);
}
clrscr();
sleep(1);
printf("\n HH   HH");
printf("\n HHHHHHH");
printf("\n HH   HH");
sleep(1);
clrscr();
printf("\n%20s","AAAAAAA");
printf("\n%20s","AA   AA");
printf("\n%20s","AAAAAAA");
printf("\n%20s","AA   AA");
sleep(1);
clrscr();
printf("\n");
printf("\n%50s","PPPPPPP");
printf("\n%50s","PP     PP");
printf("\n%50s","PP     PP");
printf("\n%50s","PPPPPPPPP");
printf("\n%50s","PP       ");
printf("\n%50s","PP       ");
sleep(1);
clrscr();
printf("\n\n");
printf("\n%30s","PPPPPPP");
printf("\n%30s","PP     PP");
printf("\n%30s","PP     PP");
printf("\n%30s","PPPPPPPPP");
printf("\n%30s","PP       ");
printf("\n%30s","PP       ");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n\t\tYY     YY");
printf("\n\t\t YY   YY");
printf("\n\t\t  YY YY ");
printf("\n\t\t    Y   ");
printf("\n\t\t    Y   ");
sleep(1);
clrscr();
printf("\n\n\n");
printf("\n%60s","BBBBBBBBBB");
printf("\n%60s","BB      BB");
printf("\n%60s","BB      BB");
printf("\n%60s","BBBBBBBBBB");
printf("\n%60s","BB      BB");
printf("\n%60s","BB      BB");
printf("\n%60s","BBBBBBBBBB");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n\n");
printf("\n%30s","   IIIIII");
printf("\n%30s","     II  ");
printf("\n%30s","     II  ");
printf("\n%30s","     II  ");
printf("\n%30s","   IIIIII");
sleep(1);
clrscr();
printf("\n\n");
printf("\n%20s","  RRRRRRR");
printf("\n%20s","  RR     RR");
printf("\n%20s","  RR     RR");
printf("\n%20s","  RRRRRRRRR");
printf("\n%20s","  RR RR    ");
printf("\n%20s","  RR   RR  ");
printf("\n%20s","  RR     RR");
sleep(1);
clrscr();
printf("\nTTTTTTTT");
printf("\n   TT   ");
printf("\n   TT   ");
printf("\n   TT   ");
sleep(1);
clrscr();
printf("\n");
printf("\n%10s"," HH   HH");
printf("\n%10s"," HHHHHHH");
printf("\n%10s"," HH   HH");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf("\n%35s"," DDDDDDD");
printf("\n%35s","   DD    DD");
printf("\n%35s","   DD    DD");
printf("\n%35s","   DD    DD");
printf("\n%35s"," DDDDDDD");
sleep(1);
clrscr();
printf("\n");
printf("\n%80s","AAAAAAA");
printf("\n%80s","AA   AA");
printf("\n%80s","AAAAAAA");
printf("\n%80s","AA   AA");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n%10s","YY     YY");
printf("\n%10s"," YY   YY");
printf("\n%10s","  YY YY ");
printf("\n%10s","    Y   ");
printf("\n%10s","    Y   ");
sleep(1);
clrscr();
sleep(3);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n%20s HAPPY BIRTHDAY %s", "", you);
printf("\n\n\n\n\n\n\n\n");
printf("%30s","My Hearty wishes to you Friend...  ");
sleep(4);
clrscr();
return 0;
}
show3()
{
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tJourney Begins in %ds",i);
sleep(1);
}
clrscr();
printf("\n\t\t\t\tJourney to Wish a FRIEND");
printf("\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTenkasi");
printf("                                                                          %c",25);
sleep(1);
printf("\t                                                                          %c",25);
sleep(1);
printf("\t                                                                    %s","ALANGULAM");
sleep(2);
printf("\t                                                                          %c",25);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                    %cR %c Y %c G",178,177,176);
sleep(3);
printf("\t                                                                        %c ",188);
sleep(1);
printf("\t                                                  TIRUNELVELI WELCOMES YOU");
sleep(2);
printf("\t                                                                       %c",25);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                            %c%c%c%c%c%c%c%c%c%c%c",205,205,205,205,205,205,205,205,205,205,205,205,185);
sleep(2);
printf("\t                                                             PALYAMKOTTAI");
sleep(2);
printf("\t                                                          %c%c%c%c%c%c%c%c%c",201,205,205,205,205,205,205,205,205);
printf("\t                %c%c%cDR.SACOE%c%c%c%c%c%c%c%c%cKURUMBUR%c%c%c%c%c%c%c%cALWAR%c%c%c%c%c%cSeidunganallur",206,205,205,254,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205);
sleep(2);
clrscr();
printf("\t\t\t\tEEE DEPARTMENT");
sleep(1);
printf("\n\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
sleep(1);
printf("\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%cHAPPY BIRTHDAY %c\n\t\t\t%c     %s   %c\n\t\t\t%c               %c\n\t\t\t%c               %c",179,179,179,179,179,179,179,179,179,179,179,you,179,179,179,179,179);
sleep(1);
printf("\n\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,47);
sleep(4);
clrscr();
return 0;
}
show4()
{
clrscr();
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tSmileys Appears in %ds",i);
sleep(1);
}
clrscr();
for(i=0;i<=381;i++)
printf(" %c%c",1,2);
k=0;

for(i=0;i<15;i++)
{
printf(" %c",ha[k][i]);
sleep(1);
}sleep(1);printf("%s",you);sleep(1);
printf(" \n\t\tEVERY MOMENT IN YOUR LIFE WOULD BE FILLED WITH HAPPINESS ");
for(i=0;i<=319;i++)
printf("%c %c",1,2);
sleep(2);
clrscr();
return 0;
}
show5()
{
clrscr();
for(i=0;i<5;i++)
printf("\n");
printf("\n%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
printf("\n%c               %c       May Everyday Bring Something New and Exciting For You.  %c               %c  May This Birthday Turn Out To Be As Amazing As You.  \n%c               %c    \n%c      PHOTO    %c    .\"\n%c  LOADING...   %c\n%c               %c\n%c               %c",179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
printf("\n%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
for(i=0;i<6;i++)
printf("\n");
for(i=0;i<78;i++)
printf("%c",196);
for(i=0;i<4;i++)
{
if(i==0)
{
printf("\t\t\t\t");
call();
for(j=0;j<4;j++)
{
for(k=0;k<11;k++)
{
printf("\b");
}
sleep(1);
call(j);
}
}
for(k=0;k<11;k++)
printf("\b");
if(i==1)
 printf("\t\t\tHAPPY BIRTHDAY %s",you);
sleep(1);
sleep(1);
if(i==2)
printf("\n\t\t\t         by");
sleep(1);
if(i==3)
printf("\n\t\t       Best Friend");
}
sleep(6);
clrscr();

return 0;
}
call(int j)
{
 if(j==0)
printf("     FLASH  NEWS");
 if(j==1)
 printf("     FRESH  NEWS");
 if(j==2)
 printf("     NEWS UPDATE");
return 0;
}
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<dos.h>
int i,j,k,l;
char ha[20][20] = {'H','A','P','P','Y',' ','B','I','R','T','H','D','A','Y'}, you[100];
void main()
{
int coun = 1n;
char r[200], r1[200];

printf("Enter your friend's name to wish ");
gets(you);

do
{
printf("  \n\n\t\t\tBirthday Wishes Platform");
printf("\n\n\t\t\t 1.Box Wishes");
printf("\n\t\t\t 2.Hide and Seek Wishes");
printf("\n\t\t\t 3.Journey to Wish");
printf("\n\t\t\t 4.Smiley Wishes");
printf("\n\t\t\t 5.FLASH NEWS");
printf("\n\t\t\t Press any key other than 1-5 to exit");
printf("\nToday is Your Birthday so Choose what you like to choose %s:",coun==1?"First":coun==2?"Second":coun==3?"Third":coun==4?"Fourth":coun==5?"Fifth":coun==6?"Sixth":"");
scanf("%d",&n);
coun++;
if(n>7||n<=0)
exit(0);
switch(n)
{
case 1:
show1();
break;
case 2:
show2();
break;
case 3:
show3();
break;
case 4:
show4();
break;
case 5:
show5();
break;
default:
exit(0);
}
}while(n>0||n<=7);
getche();
}
show1()
{
for(i=5;i>0;i--)
{

printf("\n\n\n\n\t\t\tBox will Appears within %ds",i);
sleep(1);
}
clrscr();
printf("\t");
for(i=0;i<1;i++)
{
for(j=0;j<14;j++)
{
printf("%4c",ha[i][j]);
}
}
printf("\n\t\t\t");
for(i=0;i<1;i++)
{
for(j=0;j<14;j++)
{
sleep(1);
if(j==5)
{
sleep(2);
printf("\n\t\t\t  HAPPY BIRTHDAY FRIEND\n\t\t\t\t %s"you);
continue;
}
printf("\n%10c\t\t\t\t\t\t\t%c",ha[i][j],ha[i][j]);
}
}
printf("\n\t\tGOD BLESS YOU & ALL YOUR DESIRES COMES TRUE");
sleep(4);
clrscr();
return 0;
}
show2()
{
clrscr();
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tHide & Seek Starts in %ds",i);
sleep(1);
}
clrscr();
sleep(1);
printf("\n HH   HH");
printf("\n HHHHHHH");
printf("\n HH   HH");
sleep(1);
clrscr();
printf("\n%20s","AAAAAAA");
printf("\n%20s","AA   AA");
printf("\n%20s","AAAAAAA");
printf("\n%20s","AA   AA");
sleep(1);
clrscr();
printf("\n");
printf("\n%50s","PPPPPPP");
printf("\n%50s","PP     PP");
printf("\n%50s","PP     PP");
printf("\n%50s","PPPPPPPPP");
printf("\n%50s","PP       ");
printf("\n%50s","PP       ");
sleep(1);
clrscr();
printf("\n\n");
printf("\n%30s","PPPPPPP");
printf("\n%30s","PP     PP");
printf("\n%30s","PP     PP");
printf("\n%30s","PPPPPPPPP");
printf("\n%30s","PP       ");
printf("\n%30s","PP       ");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n\t\tYY     YY");
printf("\n\t\t YY   YY");
printf("\n\t\t  YY YY ");
printf("\n\t\t    Y   ");
printf("\n\t\t    Y   ");
sleep(1);
clrscr();
printf("\n\n\n");
printf("\n%60s","BBBBBBBBBB");
printf("\n%60s","BB      BB");
printf("\n%60s","BB      BB");
printf("\n%60s","BBBBBBBBBB");
printf("\n%60s","BB      BB");
printf("\n%60s","BB      BB");
printf("\n%60s","BBBBBBBBBB");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n\n");
printf("\n%30s","   IIIIII");
printf("\n%30s","     II  ");
printf("\n%30s","     II  ");
printf("\n%30s","     II  ");
printf("\n%30s","   IIIIII");
sleep(1);
clrscr();
printf("\n\n");
printf("\n%20s","  RRRRRRR");
printf("\n%20s","  RR     RR");
printf("\n%20s","  RR     RR");
printf("\n%20s","  RRRRRRRRR");
printf("\n%20s","  RR RR    ");
printf("\n%20s","  RR   RR  ");
printf("\n%20s","  RR     RR");
sleep(1);
clrscr();
printf("\nTTTTTTTT");
printf("\n   TT   ");
printf("\n   TT   ");
printf("\n   TT   ");
sleep(1);
clrscr();
printf("\n");
printf("\n%10s"," HH   HH");
printf("\n%10s"," HHHHHHH");
printf("\n%10s"," HH   HH");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\n");
printf("\n%35s"," DDDDDDD");
printf("\n%35s","   DD    DD");
printf("\n%35s","   DD    DD");
printf("\n%35s","   DD    DD");
printf("\n%35s"," DDDDDDD");
sleep(1);
clrscr();
printf("\n");
printf("\n%80s","AAAAAAA");
printf("\n%80s","AA   AA");
printf("\n%80s","AAAAAAA");
printf("\n%80s","AA   AA");
sleep(1);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n%10s","YY     YY");
printf("\n%10s"," YY   YY");
printf("\n%10s","  YY YY ");
printf("\n%10s","    Y   ");
printf("\n%10s","    Y   ");
sleep(1);
clrscr();
sleep(3);
clrscr();
printf("\n\n\n\n\n\n\n");
printf("\n%20s HAPPY BIRTHDAY %s"""you);
printf("\n\n\n\n\n\n\n\n");
printf("%30s","My Hearty wishes to you Friend...  ");
sleep(4);
clrscr();
return 0;
}
show3()
{
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tJourney Begins in %ds",i);
sleep(1);
}
clrscr();
printf("\n\t\t\t\tJourney to Wish a FRIEND");
printf("\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTenkasi");
printf("                                                                          %c",25);
sleep(1);
printf("\t                                                                          %c",25);
sleep(1);
printf("\t                                                                    %s","ALANGULAM");
sleep(2);
printf("\t                                                                          %c",25);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                          %c",186);
sleep(1);
printf("\t                                                                    %cR %c Y %c G",178,177,176);
sleep(3);
printf("\t                                                                        %c ",188);
sleep(1);
printf("\t                                                  TIRUNELVELI WELCOMES YOU");
sleep(2);
printf("\t                                                                       %c",25);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                                       %c",186);
sleep(1);
printf("\t                                                            %c%c%c%c%c%c%c%c%c%c%c",205,205,205,205,205,205,205,205,205,205,205,205,185);
sleep(2);
printf("\t                                                             PALYAMKOTTAI");
sleep(2);
printf("\t                                                          %c%c%c%c%c%c%c%c%c",201,205,205,205,205,205,205,205,205);
printf("\t                %c%c%cDR.SACOE%c%c%c%c%c%c%c%c%cKURUMBUR%c%c%c%c%c%c%c%cALWAR%c%c%c%c%c%cSeidunganallur",206,205,205,254,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205);
sleep(2);
clrscr();
printf("\t\t\t\tEEE DEPARTMENT");
sleep(1);
printf("\n\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
sleep(1);
printf("\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%c               %c\n\t\t\t%cHAPPY BIRTHDAY %c\n\t\t\t%c     %s   %c\n\t\t\t%c               %c\n\t\t\t%c               %c",179,179,179,179,179,179,179,179,179,179,179,you,179,179,179,179,179);
sleep(1);
printf("\n\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,47);
sleep(4);
clrscr();
return 0;
}
show4()
{
clrscr();
for(i=5;i>0;i--)
{
clrscr();
printf("\n\n\n\n\t\t\tSmileys Appears in %ds",i);
sleep(1);
}
clrscr();
for(i=0;i<=381;i++)
printf(" %c%c",1,2);
k=0;

for(i=0;i<15;i++)
{
printf(" %c",ha[k][i]);
sleep(1);
}sleep(1);printf("%s",you);sleep(1);
printf(\n\t\tEVERY MOMENT IN YOUR LIFE WOULD BE FILLED WITH HAPPINESS ");
for(i=0;i<=319;i++)
printf("%c %c",1,2);
sleep(2);
clrscr();
return 0;
}
show5()
{
clrscr();
for(i=0;i<5;i++)
printf("\n");
printf("\n%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
printf("\n%c               %c       May Everyday Bring Something New and Exciting For You.  %c               %c  May This Birthday Turn Out To Be As Amazing As You.  \n%c               %c    \n%c      PHOTO    %c    .\"\n%c  LOADING...   %c\n%c               %c\n%c               %c",179,179,179,179,179,179,179,179,179,179,179,179,179,179,179,179);
printf("\n%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",196,196,196,196,196,196,196,196,196,196,196,196,196,196,196,196);
for(i=0;i<6;i++)
printf("\n");
for(i=0;i<78;i++)
printf("%c",196);
for(i=0;i<4;i++)
{
if(i==0)
{
printf("\t\t\t\t");
call();
for(j=0;j<4;j++)
{
for(k=0;k<11;k++)
{
printf("\b");
}
sleep(1);
call(j);
}
}
for(k=0;k<11;k++)
printf("\b");
if(i==1)
 printf("\t\t\tHAPPY BIRTHDAY %s",you);
sleep(1);
sleep(1);
if(i==2)
printf("\n\t\t\t         by");
sleep(1);
if(i==3)
printf("\n\t\t       Best Friend");
}
sleep(6);
clrscr();

return 0;
}
call(int j)
{
 if(j==0)
printf("     FLASH  NEWS");
 if(j==1)
 printf("     FRESH  NEWS");
 if(j==2)
 printf("     NEWS UPDATE");
return 0;
}


C Problems

 

//write a program to arithemetic operation in c
#include<stdio.h>
void main()
{
int x,y,ans,choice,a;
char yes='Y';
do
{
printf("!!!!!!!!!!!!!!!!!!!!!!!!!\n");
printf("arithemetic calculator\n");
printf("1.Add\n");
printf("2.sub\n");
printf("3.multi\n");
printf("4.divi\n");
printf("!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
printf("Please enter the choice\n");
scanf("%d",&choice);

switch(choice)
{
    case 1printf("Enter the two number to add:\n");
            scanf("%d%d",&x,&y);
             ans=x+y;
            printf("Ans is %d\n",ans);
            break;
    defaultprintf("enter choice is invalid\n");
            break;
}

printf("\n\n\nDo You Want To Use Again(Y or N)??????\n");
fflush(stdin);
scanf("%c",&yes);

a=1;


}

while(a>6);
printf("Thanking for using it");


}

2.)
#include<stdio.h>
void main()
{
int x,y,ans;
printf("Enter the two number:\n");
scanf("%d%d",&x,&y);
if(ans=x+y)
printf("Ans is %d",ans);
else
{
if(ans=x-y)
printf("Ans is %d",ans);
else
{
if(ans=x*y)
printf("Ans is %d",ans);
else
{
if(ans=x/y)
printf("Ans is %d ",ans);
else
{
printf("Ans is Invalid ");


}

}
}


}






}

3.)
// C program to draw a moving car. This
// program run in gcc compiler having
// graphics.h library installed

#include <stdio.h>

// Function to draw moving car
void draw_moving_car(void) {

    int i, j = 0;

    // Passed three arguments to initgraph
    // function to initialize graphics mode


    for (i = 0; i <= 420; i = i + 10) {

        // Set color of car as red


        // Thease lines for bonnet and
        // body of car
        line(0 + i, 300210 + i, 300);
        line(50 + i, 30075 + i, 270);
        line(75 + i, 270150 + i, 270);
        line(150 + i, 270165 + i, 300);
        line(0 + i, 3000 + i, 330);
        line(210 + i, 300210 + i, 330);

        // For left wheel of car
        circle(65 + i, 33015);
        circle(65 + i, 3302);

        // For right wheel of car
        circle(145 + i, 33015);
        circle(145 + i, 3302);

        // Line left of left wheel
        line(0 + i, 33050 + i, 330);

        // Line middle of both wheel
        line(80 + i, 330, 130 + i, 330);

        // Line right of right wheel
        line(210 + i, 330, 160 + i, 330);

        delay(100);

        // To erase previous drawn car, draw
        // the whole car at same possition
        // but color using black


        // Lines for bonnet and body of car
        line(0 + i, 300, 210 + i, 300);
        line(50 + i, 300, 75 + i, 270);
        line(75 + i, 270, 150 + i, 270);
        line(150 + i, 270, 165 + i, 300);
        line(0 + i, 300, 0 + i, 330);
        line(210 + i, 300, 210 + i, 330);

        // For left wheel of car
        circle(65 + i, 330, 15);
        circle(65 + i, 330, 2);

        // For right wheel of car
        circle(145 + i, 330, 15);
        circle(145 + i, 330, 2);

        // Line left of left wheel
        line(0 + i, 330, 50 + i, 330);

        // Line middle of both wheel
        line(80 + i, 330, 130 + i, 330);

        // Line right of right wheel
        line(210 + i, 330, 160 + i, 330);
    }

    getch();

    closegraph();
}

// Driver code
int main()
{
    draw_moving_car();

    return 0;
}

4.)
//write a program to find round off the numbers
//author:upendra
#include<stdio.h>
#include<math.h>
void main()
{
int cel,flr;
float a;
printf("enter the number to round off in ceiling and floor:\n");
scanf("%f",&a);
cel=ceil(a);
flr=floor(a);
printf("Round off value to ceiling is %d\n\n\n",cel);
printf("Round off value to floor is %d",flr);


}

5.)
/* write a program to print
a to z using while loop*/
#include<stdio.h>
void main()
{
char ch='a';
while(ch<='z')
{
printf("%c",ch);
ch++;
}
}

6.)
// write a program to get character ASCII value
// author: upendra date:10/27/2020
#include<stdio.h>
void main()
{
char a,b,c; // a,b,c are character variables
a='70';
b='71';
printf("Character is %c",a,b);









}

7.)
/* write a program to identify whether it is
character or not*/

#include<stdio.h>
void main()
{
char ch; //ch is a character variable
printf("Enter any character :");
scanf("%c",&ch);
if(ch>='a'&&ch<='z')
{printf("it is a alphabet");}
else{
if(ch>='A'&&ch<='Z')
{printf("it is a alphabet");}
else
{printf("it is not a alphabet");}
}
}

8.)
/*switch can also written for char
expression*/
#include<stdio.h>
void main()
{
char ch='z';
switch(ch)
{
case 'a':
printf("this is 'a'");
break;
case 'z':
printf("this is 'z'");
break;
default:
printf("User input is invalid");




}


}

9.)
//write a basic problem on relational operator
//author:upendra
#include<stdio.h>
void main()
{
int a,b,result;
printf("Note: 1=true and 0=false:\n");
printf("Enter the two numbers:\n");
scanf("%d%d",&a,&b);
result=a!=b;
printf("Result is %d",result);



}

10.)
#include<stdio.h>
void main()
{
char yes='Y';
int x,y;

{while(yes=='Y')
printf("Enter two numbers x and y\n");
scanf("%d%d",&x,&y);
printf("%d\n",x+y);
printf("Do you want to continue? press Y- Yes or N- No");
scanf("%c",&yes);

}
}

11.)


#include<stdio.h>
void main()
{
    float ar,b,h; // ar is area of a triangle , b is breath of triangle ,h is height
    printf("Enter the two values b,h");
    scanf("%f%f",b,h);
    ar= 1/2(b*h);
    printf("Area is %f",ar);




}


#include<stdio.h>
void main()
{
    float ar,b,h; // ar is area of a triangle , b is breath of triangle ,h is height
    printf("Enter the two values b,h");
    scanf("%f%f",b,h);
    ar= 1/2(b*h);
    printf("Area is %f",ar);




}
12.)
// write a program to convert distance b|w the two cities in meter
//inch,centimeter
//author:upendra yadav date:10/27/2020
#include<stdio.h>
void main()
{
int m,cm,km;
float ft,inch;
printf("Enter the distance b|w two cities in Km:\n");
scanf("%d",&km);
m=1000*km;
cm=m*100;
ft=cm/30.48;
inch=cm/2.54;
/* converts following answer is */
printf("the distance b|w two cities in meter is %d\n\n",m);
printf("the distance b|w two cities in Centimeter is %d\n\n",cm);
printf("the distance b|w two cities in Foot is %f\n\n",ft);
printf("the distance b|w two cities in inchs is %f\n\n",inch);










}

13.)
/*write a program to find the no. of a note in amount
*/
#include<stdio.h>
void main()
{
int amount;
printf("Enter the total amount:\n");
scanf("%d",&amount);
if(amount==500)
printf("500:");
else{
if(amount==100)
printf("100:");
else
{
if(amount==50)
printf("50:");}}}

14.)
#include<stdio.h>
 squa(float);
void main()
{
float x,y;
printf("Enter the one value to square:\n");
scanf("%f",&x);
y=squa(x);
printf("answer is %f",y);


}
squa(float a)
{
float ans;
ans=a*a;
return ans;




}

15.)
/* write a program where number is divisible
3 or 4 or not */

#include<stdio.h>
void main()
{int year;
printf("enter a year:");
scanf("%d",&year);
if(year%4==0)
{
    printf("year is a leap year");

}
else
{
    printf("year is not leap year");
}

}

16.)
#include<stdio.h>
void main()
{
int a=0;
do
{
printf("system is hacked m'aam");
}
while(a>-1);
}

17.)
//write a program to calculate electricity bill

#include<stdio.h>
void main
{
int units;//units-electricity,surcharge-20%
float Rupees; //rupees in rupees
printf("Enter the Electricity Units:\n");
scanf("%d",units);
if(units<=50)

Rupees=0.50*units;
printf("Electricity amount is %f",Rupees);
else
{
if(units<=150)

Rupees=0.75*units;
printf("Electricity amount is %f",Rupees);

else
if(units<=250)

Rupees=1.20*units;
printf("Electricity amount is %f",Rupees);


else
if(units>=250)

Rupees=1.50*units;
printf("Electricity amount is %f",Rupees);






}











}

18.)
//write a program for elctricity bill calculation
//if sur_charge if 20%
#include<stdio.h>
void main()
{
int units;
float amt,sur_charge,total_amt;
printf("Enter the units consumed:\n");
scanf("%d",&units);
if(units<=50)
{
amt=0.50*units;

}
else if(units<=150)
{
amt=25+((units-50)*0.75);


}
else if(units<=250)
{
amt=100+((units-150)*1.20);

}
else if(units>=250)
{
amt=220+((units-250)*1.50);
}

sur_charge=amt*0.20;
total_amt=sur_charge+amt;

printf("Your this months Electricity Bill is %2f",total_amt);

}

Python if / else

 Python if / else a1 = int ( input (" Enter the number: \n ")) a2 = int ( input (" Enter the number: \n ")) a3 = int ( i...