3.1.21

C program to check the given number is factor of first number or not

PROGRAM

#include <stdio.h>

#include <stdlib.h>

 

int main()

{

int n1,n2;

printf("Enter two numbers");

scanf("%d%d",&n1,&n2);

if(n1%n2==0)

    printf("second number is factor of first number");

else

    printf("second number is not factor of first number");

 

return 0;

}

OUTPUT

Enter two numbers 12 6

second number is factor of first number


No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...