0% found this document useful (0 votes)
7 views3 pages

Day 5 Dsa

The document contains several C++ programs demonstrating basic programming concepts. It includes a multiplication table, a prime number checker, a Fibonacci series generator, a nested loop example, and a character printing loop. Each program illustrates fundamental programming techniques and logic.

Uploaded by

Tushar Chandel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Day 5 Dsa

The document contains several C++ programs demonstrating basic programming concepts. It includes a multiplication table, a prime number checker, a Fibonacci series generator, a nested loop example, and a character printing loop. Each program illustrates fundamental programming techniques and logic.

Uploaded by

Tushar Chandel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Dsa

Day 5

table program

#include<iostream>
using namespace std;
int main()
{
int num =1;
for(int i =1 ; i<=10;i++)
{
cout<<num*i<<endl;
}
return 0;
}

prime no

#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<2)
{
cout<<"Not a Prime";
return 0;
}
for(int num=2; num<=n-1; num++)
{
if (n%num == 0)
cout<<"Not a Prime";
}

cout<<"prime No";
return 0;
}

• Febonacci series

#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int first_number = 0;
int second_number = 1;
int current
for(int i=3; i<=n;i++)
{
current = first_number+second_number;
second_number = current;
first_number = second_number ;
}

cout<<current;
return 0;
}

#include<iostream>
using namespace std;
int main()
{
int n;
n = 5>2-2*4;
cout<<n;
return 0;
}

nested loop
#include<iostream>
using namespace std;
int main()
{
int n;
for(int row =1 ; row<=67; row++)
{
for(int col =1; col<row; col++)
{
cout<<col<<" ";
}
cout<<endl;
}
return 0;
}

#include<iostream>
using namespace std;
int main()
{
int n;
for(int row=1;row<=5;row++)
{
char c ='a'+row-1;
for(int col=1;col<=5;col++)
cout<<c<<" ";
cout<<endl;
}

return 0;
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy