Write a program in the C programming language to check if the inputted number is a prime number or not. In this program for loop is used to create numbers from 2 to n-1 to check if they are divisible by n or not and if any of them is divisible then the control is transferred outside the for loop by using the break statement and the result is printed in negative. Below is the code of the program –
/* C Program to check if number is prime number or not */ #include<stdio.h> void main() { int n,i,ct=0,rd=0; printf("Enter any number \n"); scanf("%d",&n); for(i=2;i<n;i++) { rd=n%i; if(rd==0) { ct=1; break; } } if(ct==0) { printf("\n %d is prime number",n); } else { printf("\n %d is not prime number",n); } getch(); }
Input – 23
Output – 23 is a prime number
I WANT OUT PUT THIS PROGRAME
hi… friends
Kajal Agarwal like redrose
pls do in your pc
u missed conio.h header file to use getch()
Ã…hh jag är sÃ¥ avis!!! Jag hade inte tackat nej till parkasen i lila 😉 Jag har provat den i butik och den är perfekt för kyliga hÃdrt¶agas!
Lo attesa per tanto tempo questa poesia,e nel rileggerla dal profondo dell’anima, ad ogni verso montava,con l’andamento di una incalzante melodia, la passione e l’orgoglio.Grazie Pietro, finissimo cantore della terra amata, ancora una volta ci hai regalato un’intensissima emozione.All’anonimo: moltissimi se ne vanno, molti ritornano, nessuno dimentica.
I have two questions: How long does it take to create a collection from inception to the final product. and secondly, Which of your collections would you say is your favorite?Thank you for the great website links. I have just added a few to my favorites!How wonderful that you two work together. (BTW, you could pass for twins!)
Et pas de planche 14 de « Perdus sur une île déserte » non plus (ni 15, ni 16, ni n ? [n étant compris entre 17 et 64]) ? Mince, 2009 sera vraiment une année noire !
een goede comment eigenlijk, met uitstekende voorbeelden erbij. Zou zomaar een reactie van een reaguurder hier kunnen zijn (ikzelf heb helaas een ban). Eigenlijk vind ik de comments daaronder veel bizarder. Wat een stel afgestompte mongolen zijn het ook op KLOL:Koala: @wakkervrak; ?dat is mijn antwoord. Misschien eens naar je hart luisteren…Johan Bosman: @Wakkervrak: waar woon je, waar werk je en wie betaald (sic) jou?
Ihania nuo portit. Minullakin alkoi heti mielikuvitus pyörimään kun tuota kuorittua puuta on vaikka kuinka paljon miehen nurkissa. Niistähän voi tehdä vaikka mitä. Kasvihuone siitä kyllä jo tehtiin. Oikein hyvää työviikkoa sinulle! Siitä se sitten lähtee!
here i have a question plz.can we do it without using loop?i mean by using relational operators
Yes we can donit using relational operators ..its much easier dat way….
Wat is ‘ct’ in this program …plss reply fast
The holiday happens to coincide with the end-of-the-season for
many of the Island’s young summer employees and brings on a last chance for partying hearty on Mackinac Island. People will say just about anything to get you out to their property to see a horse, in the hopes of selling you something else they might have. Morgan is a breed of horse very much desired by the horse community as they entertain all riding disciplines.
I want to calculation explaination
Can u do it without any loop in a very simple way
hello sir can we replace ct by any other symbol without declaring it
Attacking midfielder Silva has been a consistent performer for manager Leonardo Jardim this season, scoring?eight goals and providing five assists.