diff --git a/arithematic.c b/arithematic.c new file mode 100644 index 0000000..5bc7fe5 --- /dev/null +++ b/arithematic.c @@ -0,0 +1,21 @@ +#include +#include +void main() +{ +int x,y,a,s,m,mod; +float d; +clrscr(); +printf("enter two numbers:"); +scanf("%d%d",&x,&y); +a=x+y; +s=x-y; +m=x*y; +mod=x%y; +d=(x/y); +printf("addition=%d\n",a); +printf("substraction=%d\n",s); +printf("multiplication=%d\n",m); +printf("modulus=%d\n",mod); +printf("division=%f\n",d); +getch(); +} \ No newline at end of file diff --git a/info.c b/info.c new file mode 100644 index 0000000..0d21d1c --- /dev/null +++ b/info.c @@ -0,0 +1,16 @@ +#include +int main() +{ +int rn; +char n[100],h[100],b[100]; +printf("enter name="); +gets(n); +printf("enter branch="); +gets(b); +printf("hobbies="); +gets(h); +printf("enter regd.number="); +scanf("%d",&rn); +printf("enter\n\n name=%s\n regd.number=%d\n branch=%s\n hobbies=%s",n,rn,b,h); + return 0; +} \ No newline at end of file diff --git a/leap.c b/leap.c new file mode 100644 index 0000000..078376c --- /dev/null +++ b/leap.c @@ -0,0 +1,18 @@ +#include +#include +void main() +{ +int y; +clrscr(); +printf("enter any year:"); +scanf("%d",&y); +if(y%4==0||y%100==0) +{ +printf("leap year"); +} +else +{ +printf("not a leap year"); +} +getch(); +} \ No newline at end of file diff --git a/maximum.c b/maximum.c new file mode 100644 index 0000000..49034b5 --- /dev/null +++ b/maximum.c @@ -0,0 +1,14 @@ +#include +#include +void main() +{ +int num1,num2; +clrscr(); +printf("enter the numbers to find maximum:"); +scanf("%d%d",&num1,&num2); +if(num1>num2) +printf("%d is maximum",num1); +else +printf("%d is maximum",num2); +getch(); +} \ No newline at end of file diff --git a/oddeven.c b/oddeven.c new file mode 100644 index 0000000..0bd1d1f --- /dev/null +++ b/oddeven.c @@ -0,0 +1,19 @@ +#include +#include +void main() +{ +int num; +clrscr(); +printf("enter any number to check even or odd:"); +scanf("%d",&num); +switch(num%2) +{ +case 0: +printf("number is even"); +break; +case 1: +printf("number is odd"); +break; +} +getch(); +}