diff --git a/Addition.c b/Addition.c new file mode 100644 index 00000000..3ba5312b --- /dev/null +++ b/Addition.c @@ -0,0 +1,15 @@ +#include + +int main() + +{ +int num1,num2,addition; +printf("enter the num1"); +scanf("%d",&num1); +printf("enter the num2"); +scanf("%d",&num2); +addition= num1+num2; +printf ("%d",addition); +return 0 ; + +} \ No newline at end of file diff --git a/Area of circle.c b/Area of circle.c new file mode 100644 index 00000000..d1ea1fed --- /dev/null +++ b/Area of circle.c @@ -0,0 +1,12 @@ +#include + +int main() +{ +float r,pie=3.14,area; +printf("enter the radius "); +scanf("%f",&r); +area=pie*r*r; +printf("area of the circle is %f",area); + +return 0; +} \ No newline at end of file diff --git a/Calculator.c b/Calculator.c new file mode 100644 index 00000000..56c9d435 --- /dev/null +++ b/Calculator.c @@ -0,0 +1,26 @@ +#include +#include +#include + +int main() +{ + int a, b; + int sum, sub, mult, mod; + float div; + printf("enter the value of a "); + scanf("%d", &a); + printf("enter the value of b"); + scanf("%d", &b); + sum = a + b; + printf("\n add=%d", sum); + sub = a - b; + printf("\n sub=%d", sub); + mult = a * b; + printf("\n mul=%d", mult); + div = (a)/(b); + printf("\n div=%f", div); + mod = a % b; + printf("\n mod=%d", mod); + + return 0; +} \ No newline at end of file diff --git a/Check_Prime_number.c b/Check_Prime_number.c new file mode 100644 index 00000000..a482c916 --- /dev/null +++ b/Check_Prime_number.c @@ -0,0 +1,14 @@ +#include +#include + +int main() +{ + int n, i; + printf("enter a number "); + scanf("%d",& n); + for (i = 2; i <= n; i++) + { + n % i != 0 ? printf("it is a prime number") : printf("it is a prime number"); + } + return 0; +} \ No newline at end of file diff --git a/Convert celsius to fahrenheit.c b/Convert celsius to fahrenheit.c new file mode 100644 index 00000000..66317e9a --- /dev/null +++ b/Convert celsius to fahrenheit.c @@ -0,0 +1,12 @@ +#include + +int main() +{ +float fare,cels; +printf("Enter the temperature in fahrenheit"); +scanf("fahrenheit=%f",&fare); +cels=(fare - 32)*0.5; +printf("the temperature in celsius is %f",cels); + +return 0; +} diff --git a/Example of pointer.c b/Example of pointer.c new file mode 100644 index 00000000..efec358a --- /dev/null +++ b/Example of pointer.c @@ -0,0 +1,15 @@ +#include + +int main() +{ +int age=18; +int*ptr=&age; +int _age=*ptr; +printf(" age %d",age); +printf("\n *ptr %d",*ptr); +printf("\n _age %d",_age); + +return 0; + + +} \ No newline at end of file diff --git a/Find factorial.c b/Find factorial.c new file mode 100644 index 00000000..5e2b53ed --- /dev/null +++ b/Find factorial.c @@ -0,0 +1,41 @@ +#include + +int factorial(int n); + +int main() +{ + + int n,fact,i; + printf("enter the number "); + scanf("%d",&n); + printf("factorial is %d",factorial(n)); + return 0; + +} + +int factorial(int n) + { + if(n==0) + { + return 1; + } + + int factnm1=factorial(n-1); + int factn=factnm1 * n ; + return factn; + + } + + + + + /* int i,n,fact; + for(i=0;i<=n;i++) + { + fact=n*i; + printf("%d",fact); + + return fact; + }*/ + + \ No newline at end of file diff --git a/Find no is pos or neg.c b/Find no is pos or neg.c new file mode 100644 index 00000000..51c9eae9 --- /dev/null +++ b/Find no is pos or neg.c @@ -0,0 +1,17 @@ +#include + +int main() +{ +int num; +printf("enter the num"); +scanf("%d",&num); +if(num>0) +{ + printf("the given number is positive"); +} +else +{ +printf("the given number is negative"); +} +return 0 ; +} \ No newline at end of file diff --git a/Find out max no.c b/Find out max no.c new file mode 100644 index 00000000..68a354dc --- /dev/null +++ b/Find out max no.c @@ -0,0 +1,19 @@ +#include + +int main() +{ +int a,b; +printf("enter the value of a "); +scanf("%d",&a); +printf("entefr the value of b"); +scanf("%d",&b); +if(a>b) +{ +printf("a is greater than b"); +else +{ +printf("b is greater than a"); +} +} +return 0; +} \ No newline at end of file diff --git a/Given_number_is_prime_or_not.c b/Given_number_is_prime_or_not.c new file mode 100644 index 00000000..87dae3bc --- /dev/null +++ b/Given_number_is_prime_or_not.c @@ -0,0 +1,30 @@ +#include + +int main() { + + int n, i, flag = 0; + printf("Enter a positive integer: "); + scanf("%d", &n); + + // 0 and 1 are not prime numbers + // change flag to 1 for non-prime number + if (n == 0 || n == 1) + flag = 1; + + for (i = 2; i <= n / 2; ++i) { + + + if (n % i == 0) { + flag = 1; + break; + } + } + + + if (flag == 0) + printf("%d is a prime number.", n); + else + printf("%d is not a prime number.", n); + + return 0; +} \ No newline at end of file diff --git a/Print a number from negative to positive - Copy.c b/Print a number from negative to positive - Copy.c new file mode 100644 index 00000000..cac0a9c0 --- /dev/null +++ b/Print a number from negative to positive - Copy.c @@ -0,0 +1,14 @@ +#include + +int main() +{ + int n,low; + scanf("%d",&n); + low=-n; + while(low<=n) + { + printf("%d",low); + low++; + } + +} \ No newline at end of file diff --git a/Reverse a number - Copy.c b/Reverse a number - Copy.c new file mode 100644 index 00000000..9fd94fdb --- /dev/null +++ b/Reverse a number - Copy.c @@ -0,0 +1,16 @@ +#include + +int main() +{ +int no,rem,rev=0; +printf("enter a number"); +scanf("%d",&no); +while(no!=0) +{ +rem=no%10; +rev=rev*10+rem; +no=no/10; +} +printf("%d",rev); +return 0; +} \ No newline at end of file diff --git a/SQUARE ROOT BY GOTO - Copy.c b/SQUARE ROOT BY GOTO - Copy.c new file mode 100644 index 00000000..8869dcd6 --- /dev/null +++ b/SQUARE ROOT BY GOTO - Copy.c @@ -0,0 +1,24 @@ +#include +#include + +int main() +{ + int i=0; + float ans,n; + s: + printf(" enter the number:- "); + scanf("%f", &n); + ans = sqrt(n); + printf("square root of %f is %0.1f \n",n,ans); + i++; + if (i <= 5) + { + goto s; + } + else + { + printf("you reach max limit"); + } + + return 0; +} \ No newline at end of file diff --git a/Solve polynomial equation - Copy.c b/Solve polynomial equation - Copy.c new file mode 100644 index 00000000..7ad3df5e --- /dev/null +++ b/Solve polynomial equation - Copy.c @@ -0,0 +1,11 @@ +#include + +int main() +{ + int x,a; + printf("enter the value of x"); + scanf("%d",&x); + a=4*x*x*x-5*x+9; + printf("the answer of polynomial equation is %d",a); + return 0; +} \ No newline at end of file diff --git a/Sum and Avg of 10 numbers - Copy.c b/Sum and Avg of 10 numbers - Copy.c new file mode 100644 index 00000000..8c2b6712 --- /dev/null +++ b/Sum and Avg of 10 numbers - Copy.c @@ -0,0 +1,19 @@ +#include + +int main() +{ +int num,sum=0,i; +float avg; +printf("enter the 10 number:"); +for(i=1;i<=10;i++) +{ + printf("%d",i); + scanf("%d",&num); + sum =sum + num; +} + avg=sum/10; + printf("sum of the given numbers= %d",sum); + \n printf("\n avg of the given numbers= %f",\n avg); +return 0; + +} \ No newline at end of file diff --git a/Sum of 2 no by pointers - Copy.c b/Sum of 2 no by pointers - Copy.c new file mode 100644 index 00000000..a88da247 --- /dev/null +++ b/Sum of 2 no by pointers - Copy.c @@ -0,0 +1,19 @@ + + +#include + +int main() + +{ +int a , b , *ptr , *qtr, sum; +printf("enter the value of a"); +scanf("%d",&a); +printf("enter the value of b"); +scanf("%d",&b); +ptr=&a; +qtr=&b; +sum= *ptr + *qtr; +printf("%d",sum); + +return 0; +} \ No newline at end of file diff --git a/Sum of square and cube upto any given number - Copy.c b/Sum of square and cube upto any given number - Copy.c new file mode 100644 index 00000000..cf8cb2b4 --- /dev/null +++ b/Sum of square and cube upto any given number - Copy.c @@ -0,0 +1,20 @@ +#include + +int main() +{ +int no,i=1,square,cube,sum_of_square=0,sum_of_cube=0; +printf("enter a number"); +scanf("%d",&no); +while(i<=no) +{ + square=i*i; + cube=i*i*i; + sum_of_square=sum_of_square+square; + sum_of_cube=sum_of_cube+cube; + i++; +} +printf(" sum of square %d of natural numbers id %d",no,sum_of_square); +printf("\n sum of cube %d of natural numbers id %d",no,sum_of_cube); + +return 0; +} \ No newline at end of file diff --git a/Sum upto given numbers - Copy.c b/Sum upto given numbers - Copy.c new file mode 100644 index 00000000..b5eafb6f --- /dev/null +++ b/Sum upto given numbers - Copy.c @@ -0,0 +1,15 @@ +#include + +int main() +{ +int no,i,sum=0; +printf("enter the number"); +scanf("%d",&no); +for(i=1;i<=no;i++) +{ +printf("%d",i); +sum+=i; +} +printf("\n%d",sum); +return 0; +} \ No newline at end of file diff --git a/Table - Copy.c b/Table - Copy.c new file mode 100644 index 00000000..05d20ee6 --- /dev/null +++ b/Table - Copy.c @@ -0,0 +1,13 @@ +#include + +int main() +{ +int i,n ; + printf("enter a number"); + scanf("%d", &n); + for(i=1;i<=10;i++) + { + printf("%d * %d = %d\n",n,i,(n*i)); + } + return 0; +} \ No newline at end of file diff --git a/armstrong number.c b/armstrong number.c new file mode 100644 index 00000000..c6b7c07a --- /dev/null +++ b/armstrong number.c @@ -0,0 +1,24 @@ +#include + +int main() +{ + int num, remainder, armstrongnumber, p = 0; + printf("enter a number"); + scanf("%d", &num); + while (num != 0) + { + remainder = num % 10; + p += (remainder * remainder * remainder); + num /= 10; + } + printf("%d", p); + if (num = p) + { + printf(" it is an armstrong number "); + } + else + { + printf(" it is not an armstrong number"); + } + return 0; +} \ No newline at end of file diff --git a/calculator with switch statment.c b/calculator with switch statment.c new file mode 100644 index 00000000..c9b590b6 --- /dev/null +++ b/calculator with switch statment.c @@ -0,0 +1,42 @@ +#include +#include + +int main() +{ + int a, b, c; + printf("enter the value of a"); + scanf("%d", &a); + printf("enter the value of b"); + scanf("%d", &b); + printf("enter the choice"); + scanf("%d", &c); + switch (c) + { + case 1: + printf("addition=%d", a + b); + + break; + case 2: + printf("subtraction=%d", a - b); + + break; + case 3: + printf("multiplication=%d", a * b); + + break; + case 4: + printf("division=%d", a / b); + + break; + case 5: + printf("module=%d", a % b); + + break; + + default: + printf("invalid operation"); + break; + } + + return 0; +} \ No newline at end of file diff --git a/count_digit_in_num.c b/count_digit_in_num.c new file mode 100644 index 00000000..e25fa62c --- /dev/null +++ b/count_digit_in_num.c @@ -0,0 +1,22 @@ +#include +#include + +int main() +{ + int n,m, c = 0; + printf("enter the number "); + scanf("%d", &n); + + while (n!= 0) + { + + + m= n % 10; + + c = c + m; + n=n/10; + + + } + printf("sum=%d", c); +} \ No newline at end of file diff --git a/find 3 angle of triangle.c b/find 3 angle of triangle.c new file mode 100644 index 00000000..47d22dd7 --- /dev/null +++ b/find 3 angle of triangle.c @@ -0,0 +1,17 @@ +#include + +int main() +{ +int a,b,c; +printf("enter the value of a"); +scanf("%d",&a); +printf("enter the value of b"); +scanf("%d",&b); +c=180-(a+b); +printf("%d",c); +return 0; + + + + +} \ No newline at end of file diff --git a/find max no by pointer.c b/find max no by pointer.c new file mode 100644 index 00000000..d8b3dc80 --- /dev/null +++ b/find max no by pointer.c @@ -0,0 +1,22 @@ +#include + +int main() + +{ +int a , b , *ptr1 , *ptr2; +printf("enter the value of a"); +scanf("%d",&a); +printf("enter the value of b"); +scanf("%d",&b); +ptr1=&a; +ptr2=&b; +if(*ptr1>*ptr2) +{ +printf("%d is the maximum number",*ptr1); +} +else +{ +printf("%d id the maximum number",*ptr2); +} +return 0; +} \ No newline at end of file diff --git a/for print the n odd no.c b/for print the n odd no.c new file mode 100644 index 00000000..edf1cf66 --- /dev/null +++ b/for print the n odd no.c @@ -0,0 +1,17 @@ +#include + +int main() +{ +int n,i,sum; +printf("enter the value of n"); +scanf("%d",&n); +printf("\n %d odd number",n); +for(i=1;i<=n;i=i+2) +{ + n%2!=0; +printf("%d",i); +} +sum+=i; +printf("%d",sum); +return 0; +} \ No newline at end of file diff --git a/low to high.c b/low to high.c new file mode 100644 index 00000000..5a5d5686 --- /dev/null +++ b/low to high.c @@ -0,0 +1,16 @@ +#include + +int main() +{ +int n; +printf("enter a number "); +scanf("%d",&n); + int low=-n; + while(low<=n) +{ + printf("%d",low); + low++; + +} +return 0; +} \ No newline at end of file diff --git a/max no out of 3 no.c b/max no out of 3 no.c new file mode 100644 index 00000000..9e27e77a --- /dev/null +++ b/max no out of 3 no.c @@ -0,0 +1,25 @@ +#include + +int main() +{ + int nm1, nm2, nm3; + printf("enter the value of number 1-"); + scanf("%d", &nm1); + printf("enter the value of number 2-"); + scanf("%d", &nm2); + printf("enter the value of number 3-"); + scanf("%d", &nm3); + if (nm1 > nm2 && nm1 > nm3) + { + printf("the number 1 is maximum number"); + } + else if (nm2 > nm1 && nm2 > nm3) + { + printf("the number 2 is maximum number"); + } + else + { + printf("the number 3 is maximum number"); + } + return 0; +} \ No newline at end of file diff --git a/month and days.c b/month and days.c new file mode 100644 index 00000000..ca9d7ef1 --- /dev/null +++ b/month and days.c @@ -0,0 +1,25 @@ + +#include + +int main() +{ + int number_of_days, years, months, days; + + /* Reading number of days from user */ + printf("Enter number of days: "); + scanf("%d", &number_of_days); + + years = number_of_days / 365; + + + months =number_of_days/30 ; + + days = (number_of_days - years * 365 - months*30); + + // Displaying results + printf("Years = %d", years); + printf("\nMonths = %d", months); + printf("\nDays = %d", days); + + return 0; +} \ No newline at end of file diff --git a/odd or even with using else.c b/odd or even with using else.c new file mode 100644 index 00000000..df2f9aaa --- /dev/null +++ b/odd or even with using else.c @@ -0,0 +1,17 @@ +#include + +int main() +{ +int no; +printf("enter the number "); +scanf("%d",&no); +if(no%2!=0) +{ + printf("the given number is odd "); +} +else +{ + printf("the given number is even"); +} +return 0; +} \ No newline at end of file diff --git a/odd or even without else.c b/odd or even without else.c new file mode 100644 index 00000000..f9d3cb36 --- /dev/null +++ b/odd or even without else.c @@ -0,0 +1,10 @@ +#include + +int main() +{ +int no,result,odd,even; +printf("enter a number "); +scanf("%d",&no); +no%2!=0 ?printf("the given no is odd ") : printf("the given no is even"); +return 0; +} \ No newline at end of file diff --git a/odd_or_even_of_10_no.c b/odd_or_even_of_10_no.c new file mode 100644 index 00000000..29c7efeb --- /dev/null +++ b/odd_or_even_of_10_no.c @@ -0,0 +1,28 @@ +#include +#include +int main() +{ + int n, count = 0, i, d = 0, c = 0; + + for (i = 1; i <= 10; i++) + { + printf("\nenter the number"); + scanf("%d", &n); + + + if (n% 2 == 0) + { + printf("\n%d is a even number", n); + d=d+1; + } + else + { + printf("\n%d is a odd number",n ); + c=c+1; + } + } + printf("\ncounteven=%d", d); + printf("\ncountodd=%d", c); + + return 0; +} \ No newline at end of file diff --git a/pattern-1.c b/pattern-1.c new file mode 100644 index 00000000..1183ab83 --- /dev/null +++ b/pattern-1.c @@ -0,0 +1,15 @@ +#include + +int main() +{ + int i, j; + for (i = 1; i <=4; i++) + { + for (j = 1; j <= 4; j++) + { + printf("*"); + } + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-10.c b/pattern-10.c new file mode 100644 index 00000000..0edaa47d --- /dev/null +++ b/pattern-10.c @@ -0,0 +1,21 @@ +#include + +int main() +{ + int i, j, n, s; + printf("enter the value of n"); + scanf("%d", &n); + for (i = 1; i <= n; i++) + { + + + for (j = 1; j <=i; j++) + { + printf("*"); + } + + + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-11.c b/pattern-11.c new file mode 100644 index 00000000..bbf2b086 --- /dev/null +++ b/pattern-11.c @@ -0,0 +1,22 @@ +#include + +int main() +{ + int i, s, j, n; + scanf("%d", &n); + for (i = 1; i <= n; i++) + { + for (s = 1; s <=2*i-1; s++) + { + printf(" "); + } + + for (j = 1; j <=i; j++) + { + printf("*"); + } + + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-12.c b/pattern-12.c new file mode 100644 index 00000000..f9f66238 --- /dev/null +++ b/pattern-12.c @@ -0,0 +1,23 @@ +#include + +int main() +{ + int i, j, s, n; + printf("enter the value of n"); + scanf("%d", &n); + for (i = 1; i <= n; i++) + { + for (s = 1; s <= n - i; s++) + { + printf(" "); + } + for (j = 65; j <= i+64; j++) + { + printf("%c", j); + + } + printf("\n"); + } + + return 0; +} \ No newline at end of file diff --git a/pattern-2.c b/pattern-2.c new file mode 100644 index 00000000..1cbe3259 --- /dev/null +++ b/pattern-2.c @@ -0,0 +1,18 @@ +#include + +int main() +{ + int i,j,s; + printf("enter the no of stars"); + scanf("%d",&s); + for(i=1;i<=s;i++) + { + for(j=1;j<=i;j++) + { + printf("*"); + } + printf("\n"); + } + +return 0; +} \ No newline at end of file diff --git a/pattern-3.c b/pattern-3.c new file mode 100644 index 00000000..d2d5048c --- /dev/null +++ b/pattern-3.c @@ -0,0 +1,17 @@ +#include + +int main() +{ + int i, j, s; + printf("enter the no of rows"); + scanf("%d", &s); + for (i = s; i >= 1; i--) + { + for (j = 1; j <= i; j++) + { + printf("*"); + } + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-4.c b/pattern-4.c new file mode 100644 index 00000000..07ac022a --- /dev/null +++ b/pattern-4.c @@ -0,0 +1,17 @@ +#include + +int main() +{ + int i,j,s; + scanf("%d",&s); + for(i=1;i<=5;i++) + { + + for(j=1;j<=i;j++) + { + printf(" *"); + } + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-5.c b/pattern-5.c new file mode 100644 index 00000000..002ee9f8 --- /dev/null +++ b/pattern-5.c @@ -0,0 +1,18 @@ +#include + +int main() + +{ + + int i, j; + + for (i = 5; i >= 1; i--) + { + for (j = 11; j <= 2*i - 1; j++) + { + printf("*"); + } + } + + return 0; +} diff --git a/pattern-6.c b/pattern-6.c new file mode 100644 index 00000000..63aa4fa4 --- /dev/null +++ b/pattern-6.c @@ -0,0 +1,24 @@ +#include + +int main() +{ + int i, j; + + for (i = 1; i <= 7; i++) + { + + for (j = 1; j <= i; j++) + { + if (j == 1 || i == j || i == 7) + { + printf("*"); + } + else + + printf(" "); + } + + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-7.c b/pattern-7.c new file mode 100644 index 00000000..7026319c --- /dev/null +++ b/pattern-7.c @@ -0,0 +1,22 @@ + +#include + +int main() +{ + int i, j, s; + printf(" *\n"); + for (i = 1; i <= 5; i++) + { + for (s = i; s < 5; s++) + { + printf(" "); + } + for (j = 1; j<=i; j++) + { + printf("**"); + } + + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-8.c b/pattern-8.c new file mode 100644 index 00000000..1a499db4 --- /dev/null +++ b/pattern-8.c @@ -0,0 +1,23 @@ +#include + +int main() +{ + int i, j, n, s; + printf("enter the value of n"); + scanf("%d", &n); + for (i = 1; i <= n; i++) + { + + for (s = 1; s <= n - i; s++) + { + printf(" "); + + } for (j = 1; j <= i; j++) + { + printf("*"); + } + + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pattern-9.c b/pattern-9.c new file mode 100644 index 00000000..f478f639 --- /dev/null +++ b/pattern-9.c @@ -0,0 +1,24 @@ +#include + +int main() +{ + int i, j, n, s; + printf("enter the value of n"); + scanf("%d", &n); + for (i = 1; i <= n; i++) + { + for (s = 0; s < i; s++) + { + printf(" "); + } + + for (j = 1; j <= 7 - (2 * i); j++) + { + printf("*"); + } + + + printf("\n"); + } + return 0; +} \ No newline at end of file diff --git a/pointer - Copy.c b/pointer - Copy.c new file mode 100644 index 00000000..5b83fa47 --- /dev/null +++ b/pointer - Copy.c @@ -0,0 +1,18 @@ +#include +#include + +int main() { + int a, b,sum,sub; + int *pb,*pa; + + scanf("%d %d", &a, &b); + pa=&a, + pb=&b; + + + sum=*pa+*pb; + sub=*pa-*pb; + printf("%d",sum); + printf("\n%d",sub); + return 0; +} diff --git a/prime num - Copy.c b/prime num - Copy.c new file mode 100644 index 00000000..49b1ece7 --- /dev/null +++ b/prime num - Copy.c @@ -0,0 +1,19 @@ +#include +int main(){ + int i, num, n, count; + printf("Enter the range: \n"); + scanf("%d", &n); + printf("The prime numbers in between the range 1 to %d:",n); + for(num = 1;num<=n;num++){ + count = 0; + for(i=2;i<=num/2;i++){ + if(num%i==0){ + count++; + break; + } + } + if(count==0 && num!= 1) + printf("%d ",num); + } + return 0; +} \ No newline at end of file diff --git a/prime num without loop - Copy.c b/prime num without loop - Copy.c new file mode 100644 index 00000000..9c8a57b1 --- /dev/null +++ b/prime num without loop - Copy.c @@ -0,0 +1,17 @@ +#include +#include + +int main() +{ + int n, i=2; + printf("enter a number "); + scanf("%d",& n); + y: + if( i <= n) + { + n % i != 0 ? printf("%d it is a prime number",i) : printf("%d it is not a prime number",i); + i++; + goto y; + } + return 0; +} \ No newline at end of file diff --git a/print the name by two digit - Copy.c b/print the name by two digit - Copy.c new file mode 100644 index 00000000..957fc149 --- /dev/null +++ b/print the name by two digit - Copy.c @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +int main() { + + int i,d,j; + char a[100],m; + scanf("%s",&a); + for(i=0;i<1;i++) + { + printf("\n%c %c",a[0],a[1]); + printf("\n%c %c",a[2],a[3]); + printf("\n%c %c",a[4],a[5]); + + + + } + return 0; +} \ No newline at end of file diff --git a/print the sine fun - Copy.c b/print the sine fun - Copy.c new file mode 100644 index 00000000..2b171522 --- /dev/null +++ b/print the sine fun - Copy.c @@ -0,0 +1,14 @@ +#include +#include + +int main() +{ + double sinevalue,x; + printf("please enter the value of calculate sine"); + x=0.5; + sinevalue= sin(x); + printf("the sine value of %f is = %f",x,sinevalue); + + + return 0; +} \ No newline at end of file diff --git a/print value of sine and cos function for interval - Copy.c b/print value of sine and cos function for interval - Copy.c new file mode 100644 index 00000000..a60c98db --- /dev/null +++ b/print value of sine and cos function for interval - Copy.c @@ -0,0 +1,16 @@ +#include +#include +int main() +{ + + double interval, i; + printf("Enter the interval (eg. 0.1):\n"); + scanf("%lf", &interval); + for (i=0 ;i <= 1; i += interval) + { + printf("sin(%.1f)=%.3f\n", i, sin(i)); + printf("cos(%.1f)=%.3f\n", i, cos(i)); + + } + return 0; +} \ No newline at end of file diff --git a/remaining days and month - Copy.c b/remaining days and month - Copy.c new file mode 100644 index 00000000..eb6325e5 --- /dev/null +++ b/remaining days and month - Copy.c @@ -0,0 +1,11 @@ +#include +int main () +{ + int months, days ; + printf("Enter days\n") ; + scanf("%d", &days) ; + months = days / 30 ; + days = days % 30 ; + printf("Months = %d Days = %d", months, days) ; +return 0; +} \ No newline at end of file diff --git a/reverse a number by goto statment - Copy.c b/reverse a number by goto statment - Copy.c new file mode 100644 index 00000000..2ed466da --- /dev/null +++ b/reverse a number by goto statment - Copy.c @@ -0,0 +1,19 @@ +#include +#include + +int main() +{ + int no, rem, rev = 0; + printf("enter a number"); + scanf("%d", &no); +label: + rem = no % 10; + rev = rev * 10 + rem; + no = no / 10; + if (no != 0) + { + goto label; + } + printf("%d", rev); + return 0; +} \ No newline at end of file diff --git a/sum_of_all_digits - Copy.c b/sum_of_all_digits - Copy.c new file mode 100644 index 00000000..5c29954c --- /dev/null +++ b/sum_of_all_digits - Copy.c @@ -0,0 +1,18 @@ +#include +#include +#include +#include + +int main() { + int n,m,sum=0; + scanf("%d",&n); + while(n>0) + { + + m=n%10; + sum=sum+m; + n=n/10; + } + printf("%d",sum); + return 0; +} \ No newline at end of file diff --git a/sum_of_first_and_last_num - Copy.c b/sum_of_first_and_last_num - Copy.c new file mode 100644 index 00000000..6f776d3f --- /dev/null +++ b/sum_of_first_and_last_num - Copy.c @@ -0,0 +1,27 @@ +#include +#include + +int main() +{ + int n , m,c=0; + printf("enter the nummber "); + scanf("%d",& n); + while(n!=0) + { + + m=n%10; + c=c+m; + n=n/10; + break; + } + while(n!=0) + { + n=n/10; + m=n%10; + c=c+m; + + break; + } + printf("sum of last two digit=%d",c); +return 0; +} \ No newline at end of file diff --git a/sum_of_num_by_array - Copy.c b/sum_of_num_by_array - Copy.c new file mode 100644 index 00000000..a42f25b7 --- /dev/null +++ b/sum_of_num_by_array - Copy.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +int main() +{ + + int n,a[n],sum=0,i; + scanf("%d",&n); + + for(i=1;i