Answers for "how to pritn a number in c"

C
13

how to print int in c

#include <stdio.h>
int main() {   
    int number;   
    printf("Enter an integer: ");  
    scanf("%d", &number);
    printf("You entered: %d", number);    
    return 0;
}
Posted by: Guest on June-13-2020
1

prime number in c

#include<stdio.h>
void main(){
    int num, i;
    int cp = 1;
    printf("Enter a number = ");
    scanf("%d",&num);

    if(num > 0){
        for(i = 2; i < num; i++){
            if(num % i == 0){
                cp = 0;
            }
        }
        if(cp == 1){
            printf("%d is a prime number.", num);
        }
        else{
            printf("%d isn't a prime number.", num);
        }
    }
}
Posted by: Guest on February-24-2022

Code answers related to "how to pritn a number in c"

Code answers related to "C"

Browse Popular Code Answers by Language