1. Question:C program to print hello world without using semicolon 

    Answer
    #include<stdio.h>
    void main(){
        if(printf("Hello world")){
        }
    }
    Sample Output: Hello world






    1. Report
  2. Question:C program to print hello world using while loop 

    Answer
    #include<stdio.h>
    void main(){
        while(!printf("Hello world")){
        }
    }
    Sample Output: Hello world






    1. Report
  3. Question:C program to print hello world using switch 

    Answer
    #include<stdio.h>
    void main(){
        switch(printf("Hello world")){
        }
    }
    Sample Output Hello world






    1. Report
  4. Question:How do you write a program which produces its own source code as its output in c language? 

    Answer
    #include<stdio.h>
    
    int main(){
        FILE *fp;
        char c;
    
        fp = fopen(__FILE__,"r");
     
        do{
             c= getc(fp);
             putchar(c);
        }
        while(c!=EOF);
    
        fclose(fp);
       
        return 0;
    }






    1. Report
  5. Question:Write a c program to reverse a given number 

    Answer
    #include<stdio.h>
    int main(){
        int num,r,reverse=0;
    
        printf("Enter any number: ");
        scanf("%d",&num);
    
        while(num){
             r=num%10;
             reverse=reverse*10+r;
             num=num/10;
        }
    
        printf("Reversed of number: %d",reverse);
        return 0;
    }
    Sample output: Enter any number: 12 Reversed of number: 21






    1. Report
Copyright © 2025. Powered by Intellect Software Ltd