How To Print Hello in Inverted Commas :- "Hello" ?
If you directly use "Hello" in inverted commas in Printf then they will give an Error. For that you will use
Escape Sequences . For Example :
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\"Hello\"");
getch();
}
OutPut :- "Hello"
How To Print Backslash n :- \n ?
If you directly use \n in inverted commas then they will change your output Windows Line. For that you will use
Escape Sequences . For Example :
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\\n");
getch();
}
OutPut :- \n
How To get IP Address of Our PC using C Programm ?
To Get IP Address You Should Use STDLIB.H Header File. For Example :
#include<stdlib.h>
main()
{
system("C:\\Windows\\System32\\ipconfig");
system("pause");
return 0;
}
OutPut :- 192.365.235.255
How To Shutdown Our PC using C Programm ?
To SHUTDOWN You Should Use STDLIB.H Header File. For Example :
FOR WINDOWS 7
#include <stdio.h>
#include <stdlib.h>
main()
{
char ch;
printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);
if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown /s");
return 0;
}
FOR WINDOWS XP
#include <stdio.h>
#include <stdlib.h>
main()
{
char ch;
printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);
if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown -s");
return 0;
}
If you directly use "Hello" in inverted commas in Printf then they will give an Error. For that you will use
Escape Sequences . For Example :
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\"Hello\"");
getch();
}
OutPut :- "Hello"
How To Print Backslash n :- \n ?
If you directly use \n in inverted commas then they will change your output Windows Line. For that you will use
Escape Sequences . For Example :
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\\n");
getch();
}
OutPut :- \n
How To get IP Address of Our PC using C Programm ?
To Get IP Address You Should Use STDLIB.H Header File. For Example :
#include<stdlib.h>
main()
{
system("C:\\Windows\\System32\\ipconfig");
system("pause");
return 0;
}
OutPut :- 192.365.235.255
How To Shutdown Our PC using C Programm ?
To SHUTDOWN You Should Use STDLIB.H Header File. For Example :
FOR WINDOWS 7
#include <stdio.h>
#include <stdlib.h>
main()
{
char ch;
printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);
if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown /s");
return 0;
}
FOR WINDOWS XP
#include <stdio.h>
#include <stdlib.h>
main()
{
char ch;
printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);
if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown -s");
return 0;
}
thanks and very helpfull for us
ReplyDelete