- /*C program to check whether a number entered by user is prime or not using function with no arguments but having return value */
- #include <stdio.h>
- #include <conio.h>
- int input();
- void main(){
- int num,i,flag = 0;
- num=input(); /* No argument is passed to input() */
- for(i=2; i<=num/2; ++i){
- if(num%i==0){
- flag = 1;
- break;
- }
- }
- if(flag == 1)
- printf("%d is not prime",num);
- else
- printf("%d is prime", num);
- getch();
- }
- int input(){ /* Integer value is returned from input() to calling function */
- int n;
- printf("Enter positive integer to check:\n");
- scanf("%d",&n);
- return n;
- }
Thursday 21 December 2017
Function with no Arguments but Return Value In C
Subscribe to:
Post Comments (Atom)
Upload valid file in C#
protected bool CheckFileExtandLength(HttpPostedFile HtmlDocFile) { try { Dictionary<string, byte[]>...
-
CREATE TAblE #temp ( T_Name VARCHAR(50), T_Times BIGINT ) INSERT INTO #temp(T_Name,T_Times) VALUES ('ASHISH',4) IN...
-
Step 1: Open URL: https://portal.azure.com/#home Step2 : Click Manage Azure Active Director Step3: Click Enterprise Application Step 4: Ne...
-
Injection Injection flaws, such as SQL injection, LDAP injection, and CRLF injection, occur when an attacker sends untrusted data to an ...
No comments:
Post a Comment