From bb7cc4cfaa532f8fa74fa43fa538fa75f890f43d Mon Sep 17 00:00:00 2001 From: Yash Patel <94280370+yashpatel08@users.noreply.github.com> Date: Mon, 31 Oct 2022 13:03:15 +0530 Subject: [PATCH] Add files via upload All programs are in c langucage if it is helpfull then tell me ASAP --- Addition.c | 15 +++++++ Area of circle.c | 12 ++++++ Check_Prime_number.c | 14 +++++++ Convert celsius to fahrenheit.c | 12 ++++++ Convert days into month.c | 14 +++++++ Example of pointer.c | 15 +++++++ Find no is pos or neg.c | 17 ++++++++ Find out max no.c | 19 +++++++++ Given_number_is_prime_or_not.c | 30 +++++++++++++ ... number from negative to positive - Copy.c | 14 +++++++ Sum of 2 no by pointers - Copy.c | 19 +++++++++ ...re and cube upto any given number - Copy.c | 20 +++++++++ Sum upto given numbers.c | 15 +++++++ arm num.c | 31 ++++++++++++++ armstrong number.c | 24 +++++++++++ calculator with switch statment.c | 42 +++++++++++++++++++ count_digit_in_num.c | 22 ++++++++++ find 3 angle of triangle.c | 17 ++++++++ find max no by pointer.c | 22 ++++++++++ for print the n odd no.c | 17 ++++++++ low to high.c | 16 +++++++ max no out of 3 no.c | 25 +++++++++++ month and days.c | 25 +++++++++++ odd or even with using else.c | 17 ++++++++ odd or even without else.c | 10 +++++ odd_or_even_of_10_no.c | 28 +++++++++++++ pattern-1.c | 15 +++++++ pattern-10.c | 21 ++++++++++ pattern-11.c | 22 ++++++++++ pattern-12.c | 23 ++++++++++ pattern-2.c | 18 ++++++++ pattern-3.c | 17 ++++++++ pattern-4.c | 17 ++++++++ pattern-5.c | 18 ++++++++ pattern-6.c | 24 +++++++++++ pattern-7.c | 22 ++++++++++ pattern-8.c | 23 ++++++++++ pattern.c | 25 +++++++++++ print the name by two digit.c | 21 ++++++++++ print the sine fun - Copy.c | 14 +++++++ ...ine and cos function for interval - Copy.c | 16 +++++++ sum_of_all_digits.c | 18 ++++++++ sum_of_first_and_last_num - Copy.c | 27 ++++++++++++ 43 files changed, 853 insertions(+) create mode 100644 Addition.c create mode 100644 Area of circle.c create mode 100644 Check_Prime_number.c create mode 100644 Convert celsius to fahrenheit.c create mode 100644 Convert days into month.c create mode 100644 Example of pointer.c create mode 100644 Find no is pos or neg.c create mode 100644 Find out max no.c create mode 100644 Given_number_is_prime_or_not.c create mode 100644 Print a number from negative to positive - Copy.c create mode 100644 Sum of 2 no by pointers - Copy.c create mode 100644 Sum of square and cube upto any given number - Copy.c create mode 100644 Sum upto given numbers.c create mode 100644 arm num.c create mode 100644 armstrong number.c create mode 100644 calculator with switch statment.c create mode 100644 count_digit_in_num.c create mode 100644 find 3 angle of triangle.c create mode 100644 find max no by pointer.c create mode 100644 for print the n odd no.c create mode 100644 low to high.c create mode 100644 max no out of 3 no.c create mode 100644 month and days.c create mode 100644 odd or even with using else.c create mode 100644 odd or even without else.c create mode 100644 odd_or_even_of_10_no.c create mode 100644 pattern-1.c create mode 100644 pattern-10.c create mode 100644 pattern-11.c create mode 100644 pattern-12.c create mode 100644 pattern-2.c create mode 100644 pattern-3.c create mode 100644 pattern-4.c create mode 100644 pattern-5.c create mode 100644 pattern-6.c create mode 100644 pattern-7.c create mode 100644 pattern-8.c create mode 100644 pattern.c create mode 100644 print the name by two digit.c create mode 100644 print the sine fun - Copy.c create mode 100644 print value of sine and cos function for interval - Copy.c create mode 100644 sum_of_all_digits.c create mode 100644 sum_of_first_and_last_num - Copy.c 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/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/Convert days into month.c b/Convert days into month.c new file mode 100644 index 00000000..a3719fd8 --- /dev/null +++ b/Convert days into month.c @@ -0,0 +1,14 @@ +#include + +int main() +{ +int n=0,m=0,rd=0; +printf("enter the no of days "); +scanf("%d",&n); +m=n/30; +rd=n%30; +printf("Months=%d",m); +printf("\n Remaining days=%d",rd); + +return 0; +} \ No newline at end of file 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 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/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.c b/Sum upto given numbers.c new file mode 100644 index 00000000..b5eafb6f --- /dev/null +++ b/Sum upto given numbers.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/arm num.c b/arm num.c new file mode 100644 index 00000000..c4c81006 --- /dev/null +++ b/arm num.c @@ -0,0 +1,31 @@ + +#include +#include + +int main() { + int num, originalNum, remainder, n = 0; + float result = 0.0; + + printf("Enter an integer: "); + scanf("%d", &num); + + originalNum = num; + + for (originalNum = num; originalNum != 0; ++n) { + originalNum /= 10; + } + + for (originalNum = num; originalNum != 0; originalNum /= 10) { + remainder = originalNum % 10; + + result += pow(remainder, n); + } + + + + if (result == num)1 + printf("%d is an Armstrong number.", num); + else + printf("%d is not an Armstrong number.", num); + 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.c b/pattern.c new file mode 100644 index 00000000..326e7f6b --- /dev/null +++ b/pattern.c @@ -0,0 +1,25 @@ +#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-1; j++) + { + printf("*"); + + for (s = 1; s +#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/sum_of_all_digits.c b/sum_of_all_digits.c new file mode 100644 index 00000000..5c29954c --- /dev/null +++ b/sum_of_all_digits.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