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.util.*; | |
public class Main | |
{ | |
public static void printPattern(int n) { | |
for(int i=1; i<=n; i++) { | |
if(i%2==0) { | |
System.out.println("\n"); | |
} else { | |
for(int j=1; j<=i; j++) { |
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<iostream> | |
#include<math.h> | |
using namespace std; | |
bool is_prime(int num) { | |
for(int i=2; i<=sqrt(num); i++) | |
if (num%i==0) return false; | |
return true; | |
} | |
bool is_digit_sum_equal_given_sum(int num,int given_sum) { |