diff --git a/Basic_1.c b/Basic_1.c index 5f89310..72aabe1 100644 --- a/Basic_1.c +++ b/Basic_1.c @@ -1,3 +1,21 @@ // TASK // Write code to find if the number is even or odd // Code Below +#include +#include +void main() +{ + clrscr(); + int a,b,c; + printf("enter the no. to find out whether it is even or odd"); + scanf("%d",&a); + if(a%2==0) + { + printf("no. is even"); + } + else + { + printf("no. is odd"0); + } + getch(); +} diff --git a/Basic_12.c b/Basic_12.c index 81bcbae..4227168 100644 --- a/Basic_12.c +++ b/Basic_12.c @@ -1,3 +1,15 @@ // TASK // Write code to find cube of a number // Code Below +#include +#include +void main() +{ + clrscr(); + int a,b=0,c; + printf("enter the no to take out its cube = "); + scanf("%d",&a); + b=a*a*a; + printf("cube of no. is = %d",b); + getch(); +} diff --git a/Basic_2.c b/Basic_2.c index 1b8ccc2..4cb8c82 100644 --- a/Basic_2.c +++ b/Basic_2.c @@ -1,3 +1,21 @@ // TASK // Write code to find if the number is positive or negative // Code Below +#include +#include +void main() +{ + clrscr(); + int a,b,c; + printf("enter the no. to check whether it is positive or not = "); + scanf("%d",&a); + if(a>=0) + { + printf("no. is positive"); + } + else + { + printf("no. is negative"); + } + getch(); +}