Print a string like "Karim" in C Programming
c programming have two types of comment section design
Here
1. '//'
2. '/* */ '
it can help for you understand what you about type of program you write. its comment that can not any effect of your program run. its help for understand program details.
++++++++++++++++++++++++++++++
////////////////////////////////////////////////////////////////////////
#include <stdio.h> // Header file
int main() // main function
{
printf("Hello, Karim!"); // all process
return 0; //end program
}
///////////////////////////////////////////////////////////////////////
output:
Hello, World!
Part a:
If you want Hello, Karim! print in any whare in screen like middle of your program then
///////////////////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
#include<windows.h>
void gotoxy(int a, int b)
{
COORD c;
c.X=a; // x
c.Y=b; //y
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
int main()
{
gotoxy(6, 365);
printf("hello karim");
getch();
}
/////////////////////////////////////////////////////////////////////////////////////////////////
Part 2 link: https://programmingknowledgesite.blogspot.com/2020/05/c-language-part-2-c-keywords-and.html
++++++++++++++++++++++++++++++
////////////////////////////////////////////////////////////////////////
#include <stdio.h> // Header file
int main() // main function
{
printf("Hello, Karim!"); // all process
return 0; //end program
}
///////////////////////////////////////////////////////////////////////
output:
Hello, World!
Part a:
If you want Hello, Karim! print in any whare in screen like middle of your program then
///////////////////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
#include<windows.h>
void gotoxy(int a, int b)
{
COORD c;
c.X=a; // x
c.Y=b; //y
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);
}
int main()
{
gotoxy(6, 365);
printf("hello karim");
getch();
}
0 comments:
Post a Comment