This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
class swap | |
{ | |
public static void main(String args[]) | |
{ | |
Scanner s = new Scanner(System.in); | |
System.out.print("Enter two numbers : "); | |
int m = s.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n,i; | |
printf("Enter a positive integer: "); | |
scanf("%d",&n); | |
printf("Factors of %d are: ", n); | |
for(i=1;i<=n;++i) | |
{ | |
if(n%i==0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n1, n2, i, temp, num, rem; | |
printf("Enter two numbers(intervals): "); | |
scanf("%d %d", &n1, &n2); | |
printf("Armstrong numbers between %d an %d are: ", n1, n2); | |
for(i=n1+1; i<n2; ++i) | |
{ | |
temp=i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n, n1, rem, num=0; | |
printf("Enter a positive integer: "); | |
scanf("%d", &n); | |
n1=n; | |
while(n1!=0) | |
{ | |
rem=n1%10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n1, n2, i, j, flag; | |
printf("Enter two numbers(intevals): "); | |
scanf("%d %d", &n1, &n2); | |
printf("Prime numbers between %d and %d are: ", n1, n2); | |
for(i=n1+1; i<n2; ++i) | |
{ | |
flag=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n, i, flag=0; | |
printf("Enter a positive integer: "); | |
scanf("%d",&n); | |
for(i=2;i<=n/2;++i) | |
{ | |
if(n%i==0) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n, reverse=0, rem,temp; | |
printf("Enter an integer: "); | |
scanf("%d", &n); | |
temp=n; | |
while(temp!=0) | |
{ | |
rem=temp%10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int base, exp; | |
long long int value=1; | |
printf("Enter base number and exponent respectively: "); | |
scanf("%d%d", &base, &exp); | |
while (exp!=0) | |
{ | |
value*=base; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n, reverse=0, rem; | |
printf("Enter an integer: "); | |
scanf("%d", &n); | |
while(n!=0) | |
{ | |
rem=n%10; | |
reverse=reverse*10+rem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n,count=0; | |
printf("Enter an integer: "); | |
scanf("%d", &n); | |
while(n!=0) | |
{ | |
n/=10; | |
++count; |
NewerOlder