Do Practice With C Program! And Build Your Logic!

  • By Pooja Ghodekar
  • January 23, 2023
  • C & C++
Do Practice With C Program! And Build Your Logic

Do Practice With C Program! And Build Your Logic!

Dennis Ritchie created the procedural programming language C in Bell Laboratories of AT&T Labs in 1972. It was primarily developed as a system programming language for UNIX.

The most important aspects of the C language are:

  • Universally useful and Compact
  • Low-level Memory Access
  • Quick Speed
  • Clean Sentence structure

These elements make the C language appropriate for framework programming like a working framework or compiler improvement.

For what reason Would it be a good idea for us to Learn C?

Do Practice With C Program! And Build Your Logic!Syntax and features from the C language have been copied by a lot of later languages, either directly or indirectly. Like sentence structure of Java, PHP, JavaScript, and numerous different dialects are predominantly founded on the C language. Only a small number of programs can compile in C, but not in C++; C++ is almost a superset of C.

#include<stdio.h>
int main()
{
int a,b;
int c;
printf(“value of a”);
scanf(“%d”,&a);
printf(“\n value of b”);
scanf(“%d”,&b);
c=a%b;
printf(“result of a and b is %d”,c);
return 0;
}
=====================
#include <stdio.h>
int main()
{
int a = 10;
while(a <= 25)
{
a += 2;
if(a >15 && a < 20)
continue;
printf(“%d “, a);
}
return 0;
}
======================
#include<stdio.h>
main()
{
int a;
float b;
char c;
double e;
printf(“size of in : %d”,sizeof(a));
printf(“\n size of in : %d”,sizeof(b));
printf(“\n size of in : %d”,sizeof(c));
printf(“\n size of in : %d”,sizeof(e));
}
===========================

Looking for C++ Classes in Pune, SevenMentor is the best institute to head start your programming career in the field of IT.

C programming is a widely-used language for developing applications and software. It is an imperative programming language that follows a structured programming approach. To become proficient in C programming, it is essential to practice and build logic.

Practicing with C programs can help you to develop your problem-solving skills, enhance your understanding of programming concepts, and improve your coding abilities. Additionally, it can help you to become more comfortable with the syntax and semantics of the language.

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

 

#include<stdio.h>
main()
{
int a;
a=24;
float b = 35.78;
char c[] = “sneha”;
printf(” %d \n %f \t %s”,a,b,c);
scanf(“%d”,&a);
printf(“%.2f “,b);
}
==============================
#include<stdio.h>
int main(){
int i=1,number;
printf(“Enter a number: “);
scanf(“%d”,&number);
while(i<=10){
printf(“%d \n”,(number*i));
i++;
}
return 0;
}
======================
#define PERIOD 10
#define PRINCIPAL 5000.00
main()
{
int year;
float amount, value, inrate;
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
while(year<= PERIOD)
{
printf(“%2d %8.2f \n”, year, amount);
value = amount+inrate*amount;
year = year+1;
amount = value;
}
}
======================================
#include<math.h>
#define PI 3.1416

#define MAX 180
main()
{
int angle;
float x,y;
angle=0;
printf(“Angle Cos (angle)\n\n”);
while (angle<=MAX)
{
x = (PI/MAX)*angle;
y = cos(x);
printf(“%15d %13.4f \n”,angle,y);
angle = angle+10;
}
}
====================================
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
a = 5<=8 && 6 != 5;
printf(“%d”,a);
getch();
}
=================================
#include<stdio.h>
main()
{
float sum, n, term;
int count = 1;
sum = 0;
printf(“enter value of n \n”);
scanf(“%f”,&n);
term = 1.0/n;
while(count <=n)
{
sum = sum + term;
count++;
}
printf(“sum =%f\n”, sum);
}
==============================
int mul (int a, int b);

main()
{
int a, b, c;
a=5;
b=10;
c=mul(a,b);
printf(“multiplication of %d and %d is %d”, a,b,c);
}
int mul(int x, int y);
int p,x,y;
{
p=x*y;
return (p);
}
====================================

 

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

Build Your Logic With C!

#define PERIOD 10
#define PRINCIPAL 5000.00
main()
{
int year;
float amount, value, inrate;
amount = PRINCIPAL;
inrate = 0.11;
year = 0;
while(year<= PERIOD)
{
printf(“%2d %8.2f \n”, year, amount);
value = amount+inrate*amount;
year = year+1;
amount = value;
}
}
=================================
#include<stdio.h>
main()
{
printf(“TRAVEL GUIDE \n\n”);
printf(“\n enter your choice \n “);
char character = getchar();
switch(character)
{
case ‘A’:
printf(“A air timimgs \n”);
break;

case ‘B’:
printf(“B bus timings \n”);
break;
case ‘T’:
printf(“T train timings \n”);
break;
default:
printf(“no choice \n”);
}
}
=====================================

 

Join top most C++ Training in Pune, and get knowledge from the best industry experts.

#include<stdio.h>
main()
{
int m;
float x,sum,average;
printf(“this program computes the average of a set of numbers \n”)
;
printf(“enter values one after another \n”);
printf(“enter a negative number at end \n\n”);
sum=0;
for(m=1; m<=100;++m)
{
scanf(“%f”,&x);
if(x<0)
break;
sum+=x;
}
average=sum/(float)(m-1);
printf(“\n”);
printf(“number of values=%d\n”,m-1);
printf(“sum=%f\n”,sum);
printf(“average=%f\n”,average);
}
==============================
#include<stdio.h>
#include<math.h>
main()
{
int count;
float value,high,low,sum,range,average;

sum=0;
count=0;
printf(“enter numbers in a line : inpt a negative number to end \n”);
input:
scanf(“%f”,&value);
if(value<0)
goto output;
count=count+1;
if(count==1)
high=low=value;
else if (value>high)
high=value;
else if (value<low)
low=value;
sum=sum+value;
goto input;
output:
average=sum/count;
range=high-low;
printf(“\n\n”);
printf(“total values: %d\n”,count);
printf(“highest value: %f\n lowest value : %f\n”,high,low);
printf(“range : %f\n average : %f\n”, range, average);
}
==========================================
#include<stdio.h>
main()
{
float A,B,C;
printf(“enter three values \n”);
scanf(“%f %f %f”, &A, &B, &C);
printf(“\n largest value is”);
if(A>B)
{
if(A>C)
printf(“%f \n”,A);
else
printf(“%f \n”,C);
}
else
{
if(C>B)
printf(“%f \n”,C);
else

printf(“%f \n”,B);
}
}
=====================
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
char month[12][20] = {“jan”,”feb”,”mar”,”apr”,”may”,”jun”,”jul”,”aug”,”sept”,”oct”,”nov”,”dec”};
int i;
printf(“enter the month value :”);
scanf(“%d”,&i);
if(i < 1 || i > 12)
{
printf(“incorrect value !!\n press any key to terminate the program”);
getch();
exit(0);
}
if(i!=12)
printf(“%s followed by %s”, month [i-1], month[i]);
else
printf(“%s followed by %s”,month[i-1], month[0]);
getch();
}
================================
#include<stdio.h>
main()
{
float sum;
int n;
sum = 0;
for(n=1;n<=10;++n)
{
sum = sum+1/(float)n;
printf(“%2d %6.4f\n”,n,sum);
}
}
==============================
#include<stdio.h>
main()
{
int count, i;
float weight, height;

count = 0;
printf(“enter weight and height for 10 boys \n”);
for(i=1; i<=3; i++)
{
scanf(“%f %f”, &weight, & height);
if(weight<50 && height>170)
count = count+1;
}
printf(“number of boys with weight <50 kg \n”);
printf(“and height >170 cm = %d\n”,count);
}
===================================
#include<stdio.h>
main()
{
float A,B,C;
printf(“enter three values \n”);
scanf(“%f %f %f”, &A, &B, &C);
printf(“\n largest value is”);
if(A>B)
{
if(A>C)
printf(“%f \n”,A);
else
printf(“%f \n”,C);
}
else
{
if(C>B)
printf(“%f \n”,C);
else
printf(“%f \n”,B);
}
}
===================================
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
char month[12][20] = {“jan”,”feb”,”mar”,”apr”,”may”,”jun”,”jul”,”aug”,”sept”,”oct”,”nov”,”dec”};
int i;
printf(“enter the month value :”);
scanf(“%d”,&i);

if(i < 1 || i > 12)
{
printf(“incorrect value !!\n press any key to terminate the program”);
getch();
exit(0);
}
if(i!=12)
printf(“%s followed by %s”, month [i-1], month[i]);
else
printf(“%s followed by %s”,month[i-1], month[0]);
getch();
}
================================

 

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

#include<stdio.h>
#include<conio.h>
main()
{
int num,i,y,x=40;
printf(“\n enter a number for \n generating the pyramid:\n”);
xy:
scanf(“%d”,&num);
for(y=0;y<=num;y++)
{
goto xy;
(x,y+1)
for (i=0-y;i<=y;i++)
printf(“%3d”,abs(i));
x=x-3;
}
}
================================
#include <stdio.h>
int main() {
int i, space, rows, k = 0;
printf(“Enter the number of rows: “);
scanf(“%d”, &rows);
for (i = 1; i <= rows; ++i, k = 0) {
for (space = 1; space <= rows – i; ++space) {
printf(” “);
}
while (k != 2 * i – 1) {
printf(“* “);
++k;
}

printf(“\n”);
}
return 0;
}

 

Author:-

Pooja Ghodekar

Call the Trainer and Book your free demo Class For C Programming Call now!!!
| SevenMentor Pvt Ltd.

© Copyright 2021 | SevenMentor Pvt Ltd.

Submit Comment

Your email address will not be published. Required fields are marked *

*
*