Assignment 1 : Group A
Aim:"Write a C program to check whether a input number is prime or not."
Theory : A Prime Number can be divided evenly only by 1, or itself.
And it must be a whole number greater than 1.Example: 5 can only be divided evenly by 1 or 5, so it is a prime number.
But 6 can be divided evenly by 1, 2, 3 and 6 so it is NOT a prime number (it is a composite number).
Program:
#include<stdio.h>
int main()
{
int n,i,count=0;
printf("Enter a number: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
{
Count++;
}
}
if (count==2)
printf("%d is a prime number\n",n);
else
printf("%d is not a prime number\n",n);
return 0;
}
FE Div:A,Batch:-A3
ReplyDeleteRoll no.41
good, implement the program in Practical session
DeleteGood very nice teaching prathmesh patil A2 batch 30 roll no
ReplyDeleteWell Understanding ....And Having Best Teaching A2 Batch
ReplyDeleteRoll No-22
nice teaching by projector.... totally understood....
ReplyDeleteGood. Understood A2. Batch 17 rollno
ReplyDeleteUnderstood . Good
ReplyDeleteUnderstood
ReplyDeleteNice. a2 batch roll no. 21
Understood
ReplyDeleteUnderstood
ReplyDeleteNice one easy to understand
ReplyDeleteNice one easy to understand
ReplyDeleteFE(A)
Roll no 35
good understood div-A Roll no.28 batch A2
ReplyDeletegood understood.
ReplyDeleteNice,easily understand
ReplyDeleteWell understood
ReplyDeleteWell understood
ReplyDeleteA3 batch
Well understood
ReplyDeleteFirst time understood
ReplyDeleteGood understand
ReplyDeleteGood understand
ReplyDeleteundertstood
ReplyDeleteunderstood
ReplyDeleteNice
ReplyDelete