Value of Variable in C: The following source code is written in C Programming language. It mainly consists of four sections. First section imports standard input-output library.
Section 2 is a void function which returns nothing but prints ‘=’ sign on the screen as per loop’s instruction. This loop starts from 1 and repeats until value becomes equal to 35. In each iteration, loop increments 1 in value of i. If I modify i++ to i+2 or i+3, it will add 2 or 3 respectively each time in previous value of i.
Section 3 is also a void function which returns nothing but prints new line with \n and my name.
Section 4 is main function where we make call to above created functions to render via function call line(); and header();.
int a initializes a variable of integer type. printf shows message to user and scanf waits for user to give some input. if is conditional statement which checks either user has entered value 7 or not.I have used != (not operator) to check, so it will be true, input value will not be 7 and vice versa. I have given source code below, you may copy it and run in your computer. If you find any issue, you may leave comment.
//section 1
#include<stdio.h>
//section 2
void line()
{
int i;
printf("\n");
for(i=1;i<=35;i++)
printf("=");
}
//section 3
void header()
{
printf("\n");
printf(" Coded by Arslan ud Din Shafiq");
printf("\n www.imarslan.com");
printf("\n");
}
//section 4
int main()
{
line();
header();
line();
int a;
printf("\nEnter a Number : ");
scanf("%d",&a);
if (a!=7)
printf("\nThe variable is not equal to 7.");
else printf("You have entered variable 7.\n");
return 0;
}
NGINX Server Nginx, a popular open-source web server, excels at handling high traffic websites efficiently.… Read More
In the realm of web hosting, choosing the right web server is paramount. It acts… Read More
Are indispensable for ensuring smooth, precise linear motion in many industrial applications. Whether in robotics,… Read More
Cyber attacks are becoming more frequent, complex, and damaging. They can disrupt critical operations and… Read More
With the rise of new threats and the increasing complexity of IT environments, organizations need… Read More
1. Introduction In software design, managing complex systems can be challenging. The Facade Design Pattern… Read More