Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -فقرة تصحيح النص البرمجي :
- #include <stdio.h>
- int main(){
- int tab[] = {548,7,29,31,154,14,98,246,10,489};
- srand(time(NULL));
- int random = rand()%10;
- printf("Random number: %d\n",random);
- for (int i=0; i <= random;i++){
- printf("%d\n",tab(i));
- }
- -فقرة معرفة مخرجات النص البرمجي :
- a b c d e f g h i j k l m n o p q r s t u v w x y z
- -فقرة الألغاز البرمجية :
- #include <stdio.h>
- #include <stdlib.h>
- #define IS_PRIME 1
- #define NOT_PRIME 0
- int isprimenumber(int n){
- if(n<=1)return NOT_PRIME;
- int q=(int)sqrt(n);
- int IS_OR_NOT_PRIME=IS_PRIME;
- while(q>1){
- if(n%q==0)IS_OR_NOT_PRIME=NOT_PRIME;
- q--;
- }
- return IS_OR_NOT_PRIME;
- }
- int main()
- {
- int c=1000;
- printf("Numbers are:");
- while(c>1){
- if(isprimenumber(c))printf("%d,",c);
- c--;
- }printf("1\n");//1 also but1 is not prime
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement