Thursday, September 5, 2019

C program to find that given number Is prime or not

#include "stdio.h"
main()
{
int n,i=2,out;
printf("enter n");
scanf("%d",&n);
for(i>1;i<n;i++)
{ if(n%i==0)
{ printf("not prime");
                  break;}

                }
                 
       
if (i==n)
    printf ("prime");}


No comments:

Implement stsStr Leetcode solution

  28.   Implement strStr() Easy Implement  strStr() . Given two strings  needle  and  haystack , return the index of the first occurrence of...