Question:C program to print hello world without using semicolon
Answer
#include<stdio.h> void main(){ if(printf("Hello world")){ } }Sample Output: Hello world
Question:C program to print hello world without using semicolon
#include<stdio.h> void main(){ if(printf("Hello world")){ } }Sample Output: Hello world
Question:C program to print hello world using while loop
#include<stdio.h> void main(){ while(!printf("Hello world")){ } }Sample Output: Hello world
Question:C program to print hello world using switch
#include<stdio.h> void main(){ switch(printf("Hello world")){ } }Sample Output Hello world
Question:How do you write a program which produces its own source code as its output in c language?
#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; }
Question:Write a c program to reverse a given number
#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