Sunday, September 4, 2022

"goto" statement in C Language

 goto statement in C

 The goto statement is a jump statement which is sometimes also referred to as unconditional jump statement. The goto statement can be used to jump from anywhere to anywhere within a function.

C Language में goto स्टेटमेंट एक जम्प स्टेटमेंट है कभी-कभी इसे अनकंडीशनल स्टेटमेंट भी कहते है। C प्रोग्राम में कही से कही भी जम्प करने के लिए goto स्टेटमेंट का प्रयोग करते है।

 Youtube Video



Syntax 1

label:

.

.

.

goto label;

Syntax 2 -

goto label;

.

.

.

label:

// C program to print numbers

// from 1 to 10 using goto statement

#include <stdio.h>

#include <conio.h> 

void main ( )

{

int n = 1;

label:

            printf("%d\n",n);

            n++;

if (n <= 10)

            goto label;

}

//Program to demonstrate

//goto statement in C Program

#include <stdio.h>

#include <conio.h>

void main ( )

{

int num;

clrscr ( );

printf("Enter any number");

scanf("%d",&num);

if (num % 2 == 0)

            // jump to even

            goto even;

    else

            // jump to odd

            goto odd;

even:

            printf("%d is even", num);

            // return if even

            getch();

            return;

odd:

            printf("%d is odd", num);

            getch();

}

 

Disadvantages of using goto statement:

It makes the program logic very complex.

Use of goto makes the task of analyzing and verifying the correctness of programs very difficult.

Simply avoided using break and cnontinue statements.

Tuesday, August 30, 2022

C Program to Demonstrate else-if statement

if-else-if in C

In else – if a programmer can make decision among multiple conditions. In C "if statements" are executed from the top down approach. As soon as one of the if is true, the statement associated with if is executed, and the rest of the C else – if is bypassed. If none of the conditions are true, then the final else statement will be executed.

Syntax: 


if (condition)

    statement;
else if (condition)
    statement;
else if (condition)
    statement;
else if (condition)
    statement;
.
.
else

    statement;
Youtube Video


Flow Chart



Sorce Code

 //WAP to enter any three number

//and find the largest

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int n1, n2, n3;

printf("Enter any three numbers \n");

scanf("%d%d%d",&n1,&n2,&n3);

if(n1>n2 && n1>n3)

printf("%d is larger than %d and %d",n1,n2,n3);

else if(n2>n1&&n2>n3)

printf("%d is larger than %d and %d",n2,n1,n3);

else

printf("%d is larger than %d and %d",n3,n1,n2);

printf("\nEnd of program");

getch();

}


Tuesday, August 9, 2022

C Program to understand the concept of "if-else" statement in C by Satyam Srivastava

C Program to understand the concept of "if-else" statement in C by Satyam Srivastava

If-else Statement

The if-else statement is used to perform two operations for a single condition. The if-else statement is an extension to the if statement using which, we can perform two different operations, i.e., one is for the true condition, and the other is for the false. Here, we must notice that if and else block cannot be executed in same time. The syntax of the if-else statement is given below.

if(condition)

{  

//code to be executed if condition is true  

}

else

{  

//code to be executed if condition is false  

}  

Youtube Video

 Flow Chart

Sorce Code

//WAP to understand the concept of
//if-else statement
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n;
printf("Enter any number\n");
scanf("%d",&n);
if(n % 2 == 0)
{
printf("Even number");
}
else
{
printf("Odd number");
}
getch();
}

C Program to to understandthe concept of “if” statement

C - if statement

An if statement consists of a Boolean expression followed by one or more statements.

Syntax :

The syntax of an if statement in C programming language is −

if (condition)

{

statement(s) will execute only if the boolean expression is true

}

If the Boolean expression evaluates to true, then the block of code inside the 'if' statement will be executed. If the Boolean expression evaluates to false, then the first set of code after the end of the 'if' statement (after the closing curly brace) will be executed.





/*Program to demonstrate if statement in C WAP to input total mark and mark obtained by student and determine his result according to given condition if percentage less than 50% then fail otherwise pass.*/

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int mo, tm, per;

printf("Enter total Marks\n");

scanf("%d",&tm);

printf("Enter Marks obtained by student\n");

scanf("%d",&mo);

per=mo*100/tm;

printf("Percentage obtained by student = %f",per);

if(per<50)

            {

            printf("\nFail");

            }

if(per>=50)

            {

            printf("\nPass");

            }

getch();

}

 

C Program to show the use of Mathematical Expressions


 

Program to find the sum of two number


 

Installation of Turbo C on windows PC

 


Thursday, September 1, 2016

HTML Color Code

Name        Hex       RGB
AliceBlueF0F8FF240,248,255
AntiqueWhiteFAEBD7250,235,215
Aqua00FFFF0,255,255
Aquamarine7FFFD4127,255,212
AzureF0FFFF240,255,255
BeigeF5F5DC245,245,220
BisqueFFE4C4255,228,196
Black0000000,0,0
Blanched-
AlmondFFEBCD255,235,205
Blue0000FF0,0,255
BlueViolet8A2BE2138,43,226
BrownA52A2A165,42,42
BurlyWoodDEB887222,184,135
CadetBlue5F9EA095,158,160
Chartreuse7FFF00127,255,0
ChocolateD2691E210,105,30
CoralFF7F50255,127,80
CornflowerBlue6495ED100,149,237
CornsilkFFF8DC255,248,220
CrimsonDC143C237,164,61
Cyan00FFFF0,255,255
DarkBlue00008B0,0,139
DarkCyan008B8B0,139,139
DarkGoldenRodB8860B184,134,11
Dark GreyA9A9A9169,169,169
DarkGreen0064000,100,0
DarkKhakiBDB76B189,183,107
DarkMagenta8B008B139,0,139
DarkOliveGreen556B2F85,107,47
DarkorangeFF8C00255,140,0
DarkOrchid9932CC153,50,204
DarkRed8B0000139,0,0
DarkSalmonE9967A233,150,122
DarkSeaGreen8FBC8F143,188,143
DarkSlateBlue483D8B72,61,139
DarkSlateGrey2F4F4F47,79,79
DarkTurquoise00CED10,206,209
DarkViolet9400D3148,0,211
DeepPinkFF1493255,20,147
DeepSkyBlue00BFFF0,191,255
DimGrey696969105,105,105
DodgerBlue1E90FF30,144,255
FireBrickB22222178,34,34
FloralWhiteFFFAF0255,250,240
ForestGreen228B2234,139,34
FuchsiaFF00FF255,0,255
GainsboroDCDCDC220,220,220
GhostWhiteF8F8FF248,248,255
GoldFFD700255,215,0
GoldenRodDAA520218,165,32
Grey808080128,128,128
Green0080000,128,0
GreenYellowADFF2F173,255,47
HoneyDewF0FFF0240,255,240
HotPinkFF69B4255,105,180
IndianRedCD5C5C205,92,92
Indigo4B008275,0,130
IvoryFFFFF0255,255,240
KhakiF0E68C240,230,140
LavenderE6E6FA230,230,250
LavenderBlushFFF0F5255,240,245
LawnGreen7CFC00124,252,0
LemonChiffonFFFACD255,250,205
LightBlueADD8E6173,216,230
LightCoralF08080240,128,128
LightCyanE0FFFF224,255,255
LightGolden-
RodYellowFAFAD2250,250,210
LightGrayD3D3D3211,211,211
LightGreen90EE90144,238,144
LightPinkFFB6C1255,182,193
LightSalmonFFA07A255,160,122
LightSeaGreen20B2AA32,178,170
LightSkyBlue87CEFA135,206,250
LightSlateGray778899119,136,153
LightSteelBlueB0C4DE176,196,222
LightYellowFFFFE0255,255,224
Lime00FF000,255,0
LimeGreen32CD3250,205,50
LinenFAF0E6250,240,230
MagentaFF00FF255,0,255
Maroon800000128,0,0
MediumAqua-
Marine66CDAA102,205,170
MediumBlue0000CD0,0,205
MediumOrchidBA55D3186,85,211
MediumPurple9370D8147,112,219
MediumSea-
Green3CB37160,179,113
MediumSlate-
Blue7B68EE123,104,238
MediumSpring-
Green00FA9A0,250,154
Medium-
Turquoise48D1CC72,209,204
MediumViolet-
RedC71585199,21,133
MidnightBlue19197025,25,112
MintCreamF5FFFA245,255,250
MistyRoseFFE4E1255,228,225
MoccasinFFE4B5255,228,181
NavajoWhiteFFDEAD255,222,173
Navy0000800,0,128
OldLaceFDF5E6253,245,230
Olive808000128,128,0
OliveDrab6B8E23107,142,35
OrangeFFA500255,165,0
OrangeRedFF4500255,69,0
OrchidDA70D6218,112,214
PaleGoldenRodEEE8AA238,232,170
PaleGreen98FB98152,251,152
PaleTurquoiseAFEEEE175,238,238
PaleVioletRedD87093219,112,147
PapayaWhipFFEFD5255,239,213
PeachPuffFFDAB9255,218,185
PeruCD853F205,133,63
PinkFFC0CB255,192,203
PlumDDA0DD221,160,221
PowderBlueB0E0E6176,224,230
Purple800080128,0,128
RedFF0000255,0,0
RosyBrownBC8F8F188,143,143
RoyalBlue4169E165,105,225
SaddleBrown8B4513139,69,19
SalmonFA8072250,128,114
SandyBrownF4A460244,164,96
SeaGreen2E8B5746,139,87
SeaShellFFF5EE255,245,238
SiennaA0522D160,82,45
SilverC0C0C0192,192,192
SkyBlue87CEEB135,206,235
SlateBlue6A5ACD106,90,205
SlateGrey708090112,128,144
SnowFFFAFA255,250,250
SpringGreen00FF7F0,255,127
SteelBlue4682B470,130,180
TanD2B48C210,180,140
Teal0080800,128,128
ThistleD8BFD8216,191,216
TomatoFF6347255,99,71
Turquoise40E0D064,224,208
VioletEE82EE238,130,238
WheatF5DEB3245,222,179
WhiteFFFFFF255,255,255
WhiteSmokeF5F5F5245,245,245
YellowFFFF00255,255,0