Neeraj Mishra

A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.

C program to find largest number of a list of numbers entered through keyboard

#include<stdio.h> #include<conio.h> void main() { int i,n,x,large=0; clrscr(); //to clear the screen printf(“How many numbers?”); scanf(“%d”,&n); for(i=0;i<n;++i) { printf(“nEnter number %d:”,i+1); scanf(“%d”,&x); if(x>large) large=x; } printf(“nnThe largest number is %d”,large); getch(); //to stop the screen }

C program to find largest number of a list of numbers entered through keyboard Read More »

C program to produce the following design using *'s

#include<stdio.h> #include<conio.h> void main() { int i,j,k,n; clrscr(); //to clear the screen printf(“How many lines:”); scanf(“%d”,&n); n*=2; printf(“n”); for(i=1;i<n;i+=2) { for(j=n-1;j>i;j-=2) printf(” “); for(k=1;k<=i;++k) { if(i==n-1) printf(“*”); else if(k==1||k==i) printf(“*”); else printf(” “); } printf(“n”); } getch(); //to stop the screen; }

C program to produce the following design using *'s Read More »

C++ program to calculate area of a circle,a rectangle or a triangle depending upon user's choice

#include<iostream.h>#include<conio.h>#include<math.h> void main(){ clrscr(); //to clear the screen float a,b,c,s,r,area; int ch; cout<<“***Menu***n1.Area of circlen2.Area of Rectangle”; cout<<“n3.Area of trianglenEnter your choice:”; cin>>ch; switch(ch) { case 1: { cout<<“nEnter radius of the circle:”; cin>>r; area=3.14*r*r; break; } case 2: { cout<<“nEnter length and breadth:”; cin>>a>>b; area=a*b; break; } case 3: { cout<<“nEnter three sides of

C++ program to calculate area of a circle,a rectangle or a triangle depending upon user's choice Read More »