Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- divisors
- #include<stdio.h>
- int main()
- {
- int N,i;
- printf("Enter Number ::");
- scanf("%d",&N);
- printf("1\n");
- for(i=2; i<N/2;i++)
- {
- if(N%i==0)
- {
- printf("\n%d",i); }
- }
- printf("\n%d",N);
- return 0;
- }
- divisor of 4 6
- #include<stdio.h>
- int main()
- {
- int n,i,sum=0;
- printf("Enter N ::");
- scanf("%d",&n);
- for(i=1;i<=n;i++)
- {
- if(i%8!=0)
- {
- if(i%4==0 && i%6==0)
- {
- sum=sum+i;
- }
- }}
- printf("Sum is %d",sum);
- return 0;}
- odd number
- #include<stdio.h>
- int main()
- {
- int i, sum=0;
- for(i=1;i<=100;i=i+2)
- {
- sum=sum+i;
- }
- printf("The sum of the odd number is %d",sum);
- return 0;
- }
- EVEN NUMBER
- #include<stdio.h>
- int main()
- {
- int i, sum=0;
- for(i=0;i<=100;i=i+2)
- {
- sum=sum+i;
- }
- printf("The sum of the even number is %d",sum);
- return 0;
- }
- factorial
- #include<stdio.h>
- int main()
- {
- double n,i;
- printf("Enter input ::");
- scanf("%lf",&n);
- double fact=1;
- for(i=n;i>=1;i--)
- {
- fact=fact*i;
- }
- printf("The Factorial is %lf",fact);
- return 0;
- }
- factorial(i--)
- #include<stdio.h>
- int main()
- {
- double n,i;
- printf("Enter input ::");
- scanf("%lf",&n);
- double fact=1;
- for(i=1;i<=n;i++)
- {
- fact=fact*i;
- }
- printf("The Factorial is %lf",fact);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement