Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Function with no Arguments and no Return Value In C
WhatsApp
Ashish Srivastava
Apr 21
2016
9.1
k
0
0
#include <stdio.h>
#include <conio.h>
void
prime();
void
main(){
prime();
//No argument is passed to prime().
getch();
}
void
prime(){
/* There is no return value to calling function main(). Hence, return type of prime() is void */
int
num,i,flag=0;
printf(
"Enter positive integer enter to check:\n"
);
scanf(
"%d"
,&num);
for
(i=2;i<=num/2;++i){
if
(num%i==0){
flag=1;
}
}
if
(flag==1)
printf(
"%d is not prime"
,num);
else
printf(
"%d is prime"
,num);
}
Function with no arguments
no return value
C
Up Next
Function with no Arguments and no Return Value In C